À©µµ¿ì ÇÁ·Î±×·¡¹Ö ÀÚ·á

HomePage Backward Forward Post Reply List
Delete Modify
  Á¦¸ñ   WinNT API¸¦ ÀÌ¿ëÇÑ Device 1998/04/28 (11:07)
À̸§ ±èÈ¿¿ø
¹øÈ£ 10
Á¶È¸ 364
º»¹® WinNT API¸¦ ÀÌ¿ëÇÑ Device¾ò±â

       #include <windows.h>
       #include <stdio.h>

       void main(void)
       {
       static char szDevices[65535];
       char *szCurrentDevice;
       char szName[80];

       int i=0;

       printf("Win32(R) Device Name Enmerator - James M. Finnegan, 1998\n");
       printf("copyright (c) 1998 Microsoft Systems Journal, All Rights reserved.\n\n");

       if(QueryDosDevice(NULL, szDevices, 65535) !=0)
       {
       printf("%-20.20s Accessible?\n", "Device Name");
       printf("----------------------  --------------\n");

       for(;;)
       {
       static HANDLE hDriver;

       szCurrentDevice=&szDevices[i];

       sprintf(szName, "\\\\.\\%s", szCurrentDevice);

       hDriver=CreateFile(szName, GENERIC_READ | GENERIC_WRITE,
       FILE_SHARE_READ | FILE_SHARE_WRITE,
       0,
       OPEN_EXISTING,
       0,
       0);

       if(hDriver==INVALID_HANDLE_VALUE)
       printf("%-20.20s  No: Error %ld\n",szCurrentDevice, GetLastError());

       else
       {
       printf("%-20.20s  Yes \n",szCurrentDevice);
       CloseHandle(hDriver);
       }

       while(szDevices[i] !=0)
       i++;

       i++;

       if(szDevices[i]==0)
       break;
       }
       }
       else
       printf("No Devices in list!\n");
       }


HomePage Backward Forward Post Reply List
1998 by swindler