|
Prev: Logoff and Shutdown misery
Next: FindFirstFileExW
From: zack on 1 Jul 2008 16:31 what is win USB ? the code for reading the USB should be as followes: ::ReadSector( DWORD startinglogicalsector, int numberofsectors) { char* buffer = (char*)malloc (512*numberofsectors); HANDLE hDevice ; // win 2k code DWORD bytesread; // Creating a handle to drive a: using CreateFile () function .. char _devicename[] = "\\\\.\\A:"; _devicename[4] = Drive_letter; hDevice = CreateFileA( _devicename, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL); if (hDevice == INVALID_HANDLE_VALUE) return NULL; // Setting the pointer to point to the start of the sector we want to read .. SetFilePointer (hDevice, (startinglogicalsector*512), NULL, FILE_BEGIN); if (!ReadFile (hDevice, buffer, 512*numberofsectors, &bytesread, NULL) ) return NULL; CloseHandle(hDevice); return buffer; } "Doron Holan [MSFT]" wrote: > if you end up writing your own driver, i would also suggest that you use > winusb and have your app implement the protocol and let winusb shuttle the > bits for you. > > d > > -- > Please do not send e-mail directly to this alias. this alias is for > newsgroup purposes only. > This posting is provided "AS IS" with no warranties, and confers no rights. > > > "Kerem Gümrükcü" <kareem114(a)hotmail.com> wrote in message > news:uv3p9wwuIHA.576(a)TK2MSFTNGP05.phx.gbl... > > Hi Joseph, > > > > i dont know, maybe this can help you > > > > [IrpTracker] > > http://www.osronline.com/article.cfm?article=199 > > > > [USB Snoopy] > > http://www.wingmanteam.com/usbsnoopy/ > > > > [Usb Sniffer for Windows] > > http://sourceforge.net/project/showfiles.php?group_id=34567 > > > > [LibUsb-Win32] > > http://libusb-win32.sourceforge.net/ > > > > The last one once saved me from writing some Kernel > > Code for a Device i had no real driver for it,... > > > > Maybe this will help you some way,... > > > > > > Regards > > > > Kerem > > > > > > -- > > ----------------------- > > Beste Grüsse / Best regards / Votre bien devoue > > Kerem Gümrükcü > > Microsoft Live Space: http://kerem-g.spaces.live.com/ > > Latest Open-Source Projects: http://entwicklung.junetz.de > > ----------------------- > > "This reply is provided as is, without warranty express or implied." > > > > "Joseph M. Newcomer" <newcomer(a)flounder.com> schrieb im Newsbeitrag > > news:vgd734trp5rf68jd8k3f4cql1ajahejvsc(a)4ax.com... > >> OK, I have this device which has no documentation, and black-box software > > that doesn't > >> really work very well. I need to reverse-engineer what is going out > > across the USB > >> connection and/or study ReadFile, WriteFile, and DeviceIoControl calls. > >> I > > need to write > >> working software for this mess. It doesn't do a whole lot: turn on > >> light, > > turn off light, > >> read image. The current software obnoxiously changes the video display > > resolution, which > >> causes all kinds of problems on high-res displays and multimonitor > > systems, so I'm trying > >> to write software that doesn't look like it was written by idiots who > > never saw a real > >> computer or a real GUI. > >> > >> Any suggestions for tools? I looked at filemon, but it doesn't show the > > data going back > >> and forth, just the IRPs. > >> joe > >> Joseph M. Newcomer [MVP] > >> email: newcomer(a)flounder.com > >> Web: http://www.flounder.com > >> MVP Tips: http://www.flounder.com/mvp_tips.htm > > > > > >
From: zack on 1 Jul 2008 16:35 here is a code for reading one sector of USB: ::ReadSector( DWORD startinglogicalsector, int numberofsectors) { char* buffer = (char*)malloc (512*numberofsectors); HANDLE hDevice ; // win 2k code DWORD bytesread; // Creating a handle to drive a: using CreateFile () function .. char _devicename[] = "\\\\.\\A:"; _devicename[4] = Drive_letter; hDevice = CreateFileA( _devicename, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL); if (hDevice == INVALID_HANDLE_VALUE) return NULL; // Setting the pointer to point to the start of the sector we want to read .. SetFilePointer (hDevice, (startinglogicalsector*512), NULL, FILE_BEGIN); if (!ReadFile (hDevice, buffer, 512*numberofsectors, &bytesread, NULL) ) return NULL; CloseHandle(hDevice); return buffer; } this is the cod efor reading the code for writing should be the same . zack "Doron Holan [MSFT]" wrote: > if you end up writing your own driver, i would also suggest that you use > winusb and have your app implement the protocol and let winusb shuttle the > bits for you. > > d > > -- > Please do not send e-mail directly to this alias. this alias is for > newsgroup purposes only. > This posting is provided "AS IS" with no warranties, and confers no rights. > > > "Kerem Gümrükcü" <kareem114(a)hotmail.com> wrote in message > news:uv3p9wwuIHA.576(a)TK2MSFTNGP05.phx.gbl... > > Hi Joseph, > > > > i dont know, maybe this can help you > > > > [IrpTracker] > > http://www.osronline.com/article.cfm?article=199 > > > > [USB Snoopy] > > http://www.wingmanteam.com/usbsnoopy/ > > > > [Usb Sniffer for Windows] > > http://sourceforge.net/project/showfiles.php?group_id=34567 > > > > [LibUsb-Win32] > > http://libusb-win32.sourceforge.net/ > > > > The last one once saved me from writing some Kernel > > Code for a Device i had no real driver for it,... > > > > Maybe this will help you some way,... > > > > > > Regards > > > > Kerem > > > > > > -- > > ----------------------- > > Beste Grüsse / Best regards / Votre bien devoue > > Kerem Gümrükcü > > Microsoft Live Space: http://kerem-g.spaces.live.com/ > > Latest Open-Source Projects: http://entwicklung.junetz.de > > ----------------------- > > "This reply is provided as is, without warranty express or implied." > > > > "Joseph M. Newcomer" <newcomer(a)flounder.com> schrieb im Newsbeitrag > > news:vgd734trp5rf68jd8k3f4cql1ajahejvsc(a)4ax.com... > >> OK, I have this device which has no documentation, and black-box software > > that doesn't > >> really work very well. I need to reverse-engineer what is going out > > across the USB > >> connection and/or study ReadFile, WriteFile, and DeviceIoControl calls. > >> I > > need to write > >> working software for this mess. It doesn't do a whole lot: turn on > >> light, > > turn off light, > >> read image. The current software obnoxiously changes the video display > > resolution, which > >> causes all kinds of problems on high-res displays and multimonitor > > systems, so I'm trying > >> to write software that doesn't look like it was written by idiots who > > never saw a real > >> computer or a real GUI. > >> > >> Any suggestions for tools? I looked at filemon, but it doesn't show the > > data going back > >> and forth, just the IRPs. > >> joe > >> Joseph M. Newcomer [MVP] > >> email: newcomer(a)flounder.com > >> Web: http://www.flounder.com > >> MVP Tips: http://www.flounder.com/mvp_tips.htm > > > > > >
From: Tim Roberts on 2 Jul 2008 01:00 zack <zack(a)discussions.microsoft.com> wrote: > >here is a code for reading one sector of USB: This is code for reading one sector from a USB floppy drive. That's all it is good for. The original poster was talking about a VERY different kind of device. -- Tim Roberts, timr(a)probo.com Providenza & Boekelheide, Inc.
|
Pages: 1 Prev: Logoff and Shutdown misery Next: FindFirstFileExW |