Source code of Windows XP (NT5)
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.

61 lines
1.2 KiB

  1. // Copyright (c) 1998 Microsoft Corporation
  2. #include <windows.h>
  3. #include <objbase.h>
  4. #include <assert.h>
  5. #include <mmsystem.h>
  6. #include <dsoundp.h>
  7. #include "mmdevldr.h"
  8. #include "dmusicc.h"
  9. #include "..\dmusic\dmusicp.h"
  10. #include "dmusic32.h"
  11. #include "dm32p.h"
  12. static CONST TCHAR cszMMDEVLDR[] = "\\\\.\\MMDEVLDR.VXD";
  13. static HANDLE ghMMDEVLDR = INVALID_HANDLE_VALUE;
  14. BOOL WINAPI OpenMMDEVLDR(
  15. void)
  16. {
  17. ghMMDEVLDR = CreateFile(
  18. cszMMDEVLDR,
  19. GENERIC_WRITE,
  20. FILE_SHARE_WRITE,
  21. NULL,
  22. OPEN_ALWAYS,
  23. FILE_ATTRIBUTE_NORMAL,
  24. NULL);
  25. return ghMMDEVLDR != INVALID_HANDLE_VALUE;
  26. }
  27. VOID WINAPI CloseMMDEVLDR(
  28. void)
  29. {
  30. if (ghMMDEVLDR != INVALID_HANDLE_VALUE)
  31. {
  32. CloseHandle(ghMMDEVLDR);
  33. ghMMDEVLDR = INVALID_HANDLE_VALUE;
  34. }
  35. }
  36. VOID WINAPI CloseVxDHandle(
  37. DWORD hVxDHandle)
  38. {
  39. DWORD cb;
  40. DeviceIoControl(ghMMDEVLDR,
  41. MMDEVLDR_IOCTL_CLOSEVXDHANDLE,
  42. NULL,
  43. 0,
  44. &hVxDHandle,
  45. sizeof(hVxDHandle),
  46. &cb,
  47. NULL);
  48. }