Click here to Skip to main content
15,886,823 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Custom member variable Pin
mesajflaviu12-Jan-11 4:56
mesajflaviu12-Jan-11 4:56 
QuestionImage Transparency saving but Not showing. Pin
002comp10-Jan-11 20:37
002comp10-Jan-11 20:37 
AnswerRe: Image Transparency saving but Not showing. Pin
jk chan11-Jan-11 0:46
jk chan11-Jan-11 0:46 
GeneralRe: Image Transparency saving but Not showing. Pin
002comp11-Jan-11 1:01
002comp11-Jan-11 1:01 
Question_fstat() without File Descriptor Pin
gomathylakshmanan10-Jan-11 19:49
gomathylakshmanan10-Jan-11 19:49 
AnswerRe: _fstat() without File Descriptor Pin
Andrew Brock10-Jan-11 20:07
Andrew Brock10-Jan-11 20:07 
QuestionRe: _fstat() without File Descriptor Pin
Andrew Brock10-Jan-11 23:31
Andrew Brock10-Jan-11 23:31 
QuestionGetting ERROR_INSUFFICIENT_BUFFER error in DeviceIoControl Function Pin
learningvisualc10-Jan-11 18:49
learningvisualc10-Jan-11 18:49 
Hi all,

I am trying to get Logical drives of a hard disk(\\.\PhysicalDrive0).

I have tried using DeviceIoControl function for it but i am getting GetLastError() = 122 i.e. ERROR_INSUFFICIENT_BUFFER error.
My code is as follows:-

HANDLE hDevice;

	hDevice = CreateFile("\\.\PhysicalDrive0"    // drive 
                              0,                    // no access to the drive
                              FILE_SHARE_READ |    // share mode
                              FILE_SHARE_WRITE, 
                              NULL,              // default security attributes
                              OPEN_EXISTING,    // disposition
                              0,               // file attributes
                              NULL);          // do not copy file attributes



	PARTITION_INFORMATION_EX obj;
	DWORD cb;
	

	BOOL iu = DeviceIoControl(hDevice,                             // handle to a partition
				  IOCTL_DISK_GET_PARTITION_INFO_EX,   // dwIoControlCode
				  NULL,                              // lpInBuffer
				  0,                                // nInBufferSize
				  &obj,			           // output buffer
				  sizeof(obj),                    // size of output buffer
				  &cb,                           // number of bytes returned
				  NULL                          // OVERLAPPED structure
				 );
	if(iu == 0)
	{
		DWORD err = GetLastError();
		CString str;
		str.Format("%d",err);
		AfxMessageBox(str);
	}
	CloseHandle(hDevice);


I am not getting where exactly is the problem...
How can i do this..
Thanks in advance
AnswerRe: Getting ERROR_INSUFFICIENT_BUFFER error in DeviceIoControl Function Pin
Andrew Brock10-Jan-11 19:57
Andrew Brock10-Jan-11 19:57 
QuestionFont in CWnd Pin
includeh1010-Jan-11 17:31
includeh1010-Jan-11 17:31 
AnswerRe: Font in CWnd Pin
Richard MacCutchan10-Jan-11 23:28
mveRichard MacCutchan10-Jan-11 23:28 
AnswerRe: Font in CWnd Pin
User 742933810-Jan-11 23:47
professionalUser 742933810-Jan-11 23:47 
AnswerRe: Font in CWnd Pin
User 742933810-Jan-11 23:43
professionalUser 742933810-Jan-11 23:43 
AnswerRe: Font in CWnd Pin
jk chan11-Jan-11 0:48
jk chan11-Jan-11 0:48 
Questionusing ADO to get a clob out value through store procedure in oracle Pin
white jungle10-Jan-11 15:55
white jungle10-Jan-11 15:55 
QuestionRefresh/redraw controls in CFormView Pin
jaknupp10-Jan-11 11:17
jaknupp10-Jan-11 11:17 
AnswerRe: Refresh/redraw controls in CFormView Pin
KingsGambit10-Jan-11 19:18
KingsGambit10-Jan-11 19:18 
QuestionConvert Windows application to Linux application Pin
Stephane-M10-Jan-11 4:01
Stephane-M10-Jan-11 4:01 
GeneralRe: Convert Windows application to Linux application Pin
User 742933810-Jan-11 4:07
professionalUser 742933810-Jan-11 4:07 
GeneralRe: Convert Windows application to Linux application Pin
Stephane-M10-Jan-11 4:17
Stephane-M10-Jan-11 4:17 
GeneralRe: Convert Windows application to Linux application Pin
User 742933810-Jan-11 4:41
professionalUser 742933810-Jan-11 4:41 
GeneralRe: Convert Windows application to Linux application Pin
Stephane-M10-Jan-11 23:09
Stephane-M10-Jan-11 23:09 
GeneralRe: Convert Windows application to Linux application Pin
Richard MacCutchan10-Jan-11 23:23
mveRichard MacCutchan10-Jan-11 23:23 
GeneralRe: Convert Windows application to Linux application Pin
Stephane-M11-Jan-11 2:15
Stephane-M11-Jan-11 2:15 
GeneralRe: Convert Windows application to Linux application Pin
Rozis11-Jan-11 9:56
Rozis11-Jan-11 9:56 

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.