Click here to Skip to main content
15,895,538 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionSerial Number Via USB Pin
VonHagNDaz17-Oct-06 3:43
VonHagNDaz17-Oct-06 3:43 
AnswerRe: Serial Number Via USB Pin
David Crow17-Oct-06 4:01
David Crow17-Oct-06 4:01 
GeneralRe: Serial Number Via USB Pin
VonHagNDaz17-Oct-06 4:20
VonHagNDaz17-Oct-06 4:20 
GeneralRe: Serial Number Via USB Pin
Cedric Moonen17-Oct-06 4:32
Cedric Moonen17-Oct-06 4:32 
GeneralRe: Serial Number Via USB Pin
VonHagNDaz17-Oct-06 4:42
VonHagNDaz17-Oct-06 4:42 
GeneralRe: Serial Number Via USB Pin
VonHagNDaz17-Oct-06 5:05
VonHagNDaz17-Oct-06 5:05 
QuestionRe: Serial Number Via USB Pin
David Crow17-Oct-06 5:10
David Crow17-Oct-06 5:10 
AnswerRe: Serial Number Via USB Pin
VonHagNDaz17-Oct-06 5:34
VonHagNDaz17-Oct-06 5:34 
	<br />
typedef struct _MEDIA_SERIAL_NUMBER_DATA {<br />
		ULONG msn_SerialNumberLength;            // offset 00<n><br />
		ULONG msn_Result;			// offset 04<n><br />
		ULONG msn_AuthCommand;			// offset 08<n><br />
		ULONG msn_Reserved;			// offset 12<n><br />
		UCHAR msn_SerialNumberData[1];          // offset 16<n><br />
	} MEDIA_SERIAL_NUMBER_DATA, *PMEDIA_SERIAL_NUMBER_DATA; <n> <br />
<br />
	HRESULT hr;<n><br />
	HANDLE hdStgDrvr;<n><br />
	PMEDIA_SERIAL_NUMBER_DATA pMSN;<n><br />
	DWORD dwRet, dwLen;<n><br />
	<br />
	dwLen = DEFAULT_MEDIA_SERIAL_NUMBER_LENGTH;<n><br />
	pMSN = (PMEDIA_SERIAL_NUMBER_DATA)malloc(sizeof(MEDIA_SERIAL_NUMBER_DATA)<n><br />
					+dwLen + 1);<br />
<br />
	if(pMSN)<n><br />
	{<br />
		hdStgDrvr = CreateFile((LPCWSTR)"\\\\.\\USB006", GENERIC_READ,<n><br />
				FILE_SHARE_READ, NULL, OPEN_EXISTING,<n><br />
FILE_ATTRIBUTE_NORMAL, NULL);<n><br />
		<br />
		if (hdStgDrvr != INVALID_HANDLE_VALUE && <n><br />
			DeviceIoControl(hdStgDrvr, IOCTL_STORAGE_GET_MEDIA_SERIAL_NUMBER,<n> <br />
			NULL, 0, (LPVOID)&pMSN, (DWORD)sizeof(*pMSN)+dwLen, &dwRet, NULL))<n><br />
		{<br />
			printf("You Win1!\n");<n><br />
			hr = 0L;<n><br />
		}<br />
		else<n><br />
		{<br />
			printf("You Should Commit Sepiku1!\n");<n><br />
			hr = GetLastError();<n><br />
		}



this is basically what im trying to get to work where "\\\\.\\USB001" is the many things ive tried up to this point.

the registry suggestion does show i have a c86 printer on USB006, but provides me with no information as to serial number.
QuestionRe: Serial Number Via USB Pin
David Crow17-Oct-06 6:22
David Crow17-Oct-06 6:22 
AnswerRe: Serial Number Via USB Pin
VonHagNDaz17-Oct-06 7:05
VonHagNDaz17-Oct-06 7:05 
QuestionRe: Serial Number Via USB Pin
David Crow17-Oct-06 7:22
David Crow17-Oct-06 7:22 
AnswerRe: Serial Number Via USB Pin
VonHagNDaz17-Oct-06 7:32
VonHagNDaz17-Oct-06 7:32 
QuestionRe: Serial Number Via USB Pin
David Crow17-Oct-06 7:41
David Crow17-Oct-06 7:41 
AnswerRe: Serial Number Via USB Pin
VonHagNDaz17-Oct-06 7:45
VonHagNDaz17-Oct-06 7:45 
QuestionRe: Serial Number Via USB Pin
David Crow17-Oct-06 8:59
David Crow17-Oct-06 8:59 
AnswerRe: Serial Number Via USB Pin
VonHagNDaz17-Oct-06 9:04
VonHagNDaz17-Oct-06 9:04 
GeneralRe: Serial Number Via USB Pin
VonHagNDaz17-Oct-06 10:34
VonHagNDaz17-Oct-06 10:34 
QuestionRe: Serial Number Via USB Pin
David Crow17-Oct-06 10:51
David Crow17-Oct-06 10:51 
AnswerRe: Serial Number Via USB Pin
VonHagNDaz17-Oct-06 11:07
VonHagNDaz17-Oct-06 11:07 
QuestionCommon File Dialog (SetControlText) - Vista Pin
me17-Oct-06 3:34
me17-Oct-06 3:34 
AnswerRe: Common File Dialog (SetControlText) - Vista Pin
TomJena6-Dec-09 10:16
TomJena6-Dec-09 10:16 
Questionhow do you code for the automatic generation of employee no Pin
paradise_517-Oct-06 3:31
paradise_517-Oct-06 3:31 
AnswerRe: how do you code for the automatic generation of employee no Pin
Cedric Moonen17-Oct-06 3:34
Cedric Moonen17-Oct-06 3:34 
AnswerRe: how do you code for the automatic generation of employee no Pin
David Crow17-Oct-06 3:56
David Crow17-Oct-06 3:56 
Questionhow to create two views for one doc in MDI Pin
chethu66517-Oct-06 2:25
chethu66517-Oct-06 2:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.