The loop below doesn't work, I was wondering if anyone can help me. I need to create an infinate loop around the while condition.
The error states that 'd' is undeclared
Thank you all :)
[code=cpp]
#include "windows.h"
#include "winioctl.h "
#include <string>
#include <iostream>
using std::string;
using namespace std;
int main(int argc, char* argv[])
{
string sdrive("\\\\.\\ e:");
HANDLE hcd = CreateFile(sdri ve.c_str(),
GENERIC_READ,
FILE_SHARE_READ ,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_ READONLY,
NULL);
while(1)
{
DeviceIoControl (hcd, IOCTL_STORAGE_E JECT_MEDIA, NULL, 0, NULL, 0,
&d,NULL);
DeviceIoControl (hcd, IOCTL_STORAGE_L OAD_MEDIA, NULL, 0, NULL, 0,
&d,NULL);
}
CloseHandle(hcd );
return 0;
}[/code]
The error states that 'd' is undeclared
Thank you all :)
[code=cpp]
#include "windows.h"
#include "winioctl.h "
#include <string>
#include <iostream>
using std::string;
using namespace std;
int main(int argc, char* argv[])
{
string sdrive("\\\\.\\ e:");
HANDLE hcd = CreateFile(sdri ve.c_str(),
GENERIC_READ,
FILE_SHARE_READ ,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_ READONLY,
NULL);
while(1)
{
DeviceIoControl (hcd, IOCTL_STORAGE_E JECT_MEDIA, NULL, 0, NULL, 0,
&d,NULL);
DeviceIoControl (hcd, IOCTL_STORAGE_L OAD_MEDIA, NULL, 0, NULL, 0,
&d,NULL);
}
CloseHandle(hcd );
return 0;
}[/code]
Comment