Click here to Skip to main content
16,008,010 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I'm developing the application for partitioning the pen drive. For that i'm using CreateFile function for opening the device handle. The function is:
C++
CreateFile(
LPCTSTR lpFileName, // file name
DWORD dwDesiredAccess, // access mode
DWORD dwShareMode, // share mode
LPSECURITY_ATTRIBUTES lpSecurityAttributes, // SD
DWORD dwCreationDisposition, // how to create
DWORD dwFlagsAndAttributes, // file attributes
HANDLE hTemplateFile // handle to template
file
);

How do I determine what the first parameter should be? I guess it should be something similar to

C++
"\\\\.\\xxxUSBxxx;


Where can I look for clues on what this string should be?

Thanks in Advance
Regards
Mohanraj
Posted
Updated 23-Nov-10 1:00am
v2

1 solution

You can get the deviceId from WMI and the Win32_DiskDrive class.

Don't repost the same question in multiple places. It makes collaborting on an answer impossible.

And it's not \\.\xxxUSBxxx. It'll be in the format \\.\PHYSICALDRIVE0 \\.\PHYSICALDRIVE1 \\.\PHYSICALDRIVE2 \\PHYSICALDRIVE3 ...
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900