Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

65 lines
1.7 KiB

  1. #define UNICODE
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. #include <windows.h>
  5. #include <winioctl.h>
  6. #include <shdcom.h>
  7. #include <smbdebug.h>
  8. CHAR *ProgName = "cscgetinfo";
  9. PBYTE InBuf[0x50];
  10. PBYTE OutBuf = NULL;
  11. #define STATUS_SUCCESS ((ULONG)0x00000000L)
  12. #define STATUS_BUFFER_TOO_SMALL ((ULONG)0xC0000023L)
  13. _cdecl
  14. main(LONG argc, CHAR *argv[])
  15. {
  16. BOOL bResult;
  17. HANDLE hShadow=NULL;
  18. ULONG junk;
  19. SHADOWINFO sSI;
  20. WIN32_FIND_DATAW Find32W;
  21. printf("Starting....\n");
  22. hShadow = CreateFile(
  23. L"\\\\.\\shadow",
  24. GENERIC_READ | GENERIC_WRITE,
  25. FILE_SHARE_READ | FILE_SHARE_WRITE,
  26. NULL,
  27. OPEN_EXISTING,
  28. 0,
  29. NULL);
  30. if (hShadow == INVALID_HANDLE_VALUE) {
  31. printf("Failed open of shadow device\n");
  32. return 0;
  33. }
  34. memset(&sSI, 0, sizeof(SHADOWINFO));
  35. sSI.uStatus = SHADOW_SWITCH_SHADOWING;
  36. sSI.uOp = SHADOW_SWITCH_GET_STATE;
  37. sSI.lpFind32 = &Find32W;
  38. bResult = DeviceIoControl(
  39. hShadow, // device
  40. IOCTL_SWITCHES, // control code
  41. (LPVOID)&sSI, // in buffer
  42. 0, // in buffer size
  43. NULL, // out buffer
  44. 0, // out buffer size
  45. &junk, // bytes returned
  46. NULL); // overlapped
  47. CloseHandle(hShadow);
  48. printf("cFileName:%ws\n", Find32W.cFileName);
  49. return 0;
  50. }