1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
/* 应用程序打开设备与关闭设备的请求 by exchen 2009-10-07 */ #include <windows.h> #include <stdio.h> int main() { HANDLE hDevice = CreateFile("\\\\.\\MySymLink", GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL ); if (hDevice == INVALID_HANDLE_VALUE) { printf("Create device error\n"); } else { printf("Create device success\n"); } CloseHandle(hDevice); getchar(); return 0; } |
转载请注明:exchen's blog » 应用程序打开设备与关闭设备的请求