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.

130 lines
3.1 KiB

  1. #include "windows.h"
  2. #if defined(__cplusplus)
  3. extern "C"
  4. {
  5. #endif
  6. typedef
  7. BOOL
  8. (WINAPI *
  9. PFN_GET_VOLUME_PATHNAMES_FOR_VOLUME_NAME_A)(
  10. LPCSTR lpszVolumeName,
  11. LPSTR lpszVolumePathNames,
  12. DWORD cchBufferLength,
  13. PDWORD lpcchReturnLength
  14. );
  15. typedef
  16. BOOL
  17. (WINAPI *
  18. PFN_GET_VOLUME_PATHNAMES_FOR_VOLUME_NAME_W)(
  19. LPCWSTR lpszVolumeName,
  20. LPWSTR lpszVolumePathNames,
  21. DWORD cchBufferLength,
  22. PDWORD lpcchReturnLength
  23. );
  24. typedef
  25. BOOL
  26. (WINAPI *
  27. PFN_GET_VOLUME_PATHNAMES_FOR_VOLUME_NAME_VOID)(
  28. const void * lpszVolumeName,
  29. void * lpszVolumePathNames,
  30. DWORD cchBufferLength,
  31. PDWORD lpcchReturnLength
  32. );
  33. BOOL
  34. WINAPI
  35. FusionpGetVolumePathNamesForVolumeNameGeneric(
  36. const void * lpszVolumeName,
  37. void * lpszVolumePathNames,
  38. DWORD cchBufferLength,
  39. PDWORD lpcchReturnLength,
  40. const char * Name,
  41. PFN_GET_VOLUME_PATHNAMES_FOR_VOLUME_NAME_VOID * FunctionPointer,
  42. DWORD * Error
  43. )
  44. {
  45. DWORD LocalError;
  46. PFN_GET_VOLUME_PATHNAMES_FOR_VOLUME_NAME_VOID LocalFunctionPointer;
  47. if ((LocalError = *Error) != NO_ERROR)
  48. {
  49. SetLastError(LocalError);
  50. return FALSE;
  51. }
  52. if (*FunctionPointer == NULL)
  53. {
  54. HMODULE Kernel32 = LoadLibraryW(L"Kernel32.dll");
  55. if (Kernel32 == NULL)
  56. {
  57. if ((*Error = GetLastError()) == NO_ERROR)
  58. *Error = ERROR_PROC_NOT_FOUND;
  59. return FALSE;
  60. }
  61. LocalFunctionPointer = *FunctionPointer = (PFN_GET_VOLUME_PATHNAMES_FOR_VOLUME_NAME_VOID)GetProcAddress(Kernel32, Name);
  62. if (LocalFunctionPointer == NULL)
  63. {
  64. if ((*Error = GetLastError()) == NO_ERROR)
  65. *Error = ERROR_PROC_NOT_FOUND;
  66. return FALSE;
  67. }
  68. }
  69. return (**FunctionPointer)(lpszVolumeName, lpszVolumePathNames, cchBufferLength, lpcchReturnLength);
  70. }
  71. BOOL
  72. WINAPI
  73. FusionpGetVolumePathNamesForVolumeNameA(
  74. LPCSTR lpszVolumeName,
  75. LPSTR lpszVolumePathNames,
  76. DWORD cchBufferLength,
  77. PDWORD lpcchReturnLength
  78. )
  79. {
  80. static PFN_GET_VOLUME_PATHNAMES_FOR_VOLUME_NAME_VOID FunctionPointer;
  81. static DWORD Error;
  82. return FusionpGetVolumePathNamesForVolumeNameGeneric(
  83. lpszVolumeName,
  84. lpszVolumePathNames,
  85. cchBufferLength,
  86. lpcchReturnLength,
  87. "FusionpGetVolumePathNamesForVolumeNameA",
  88. &FunctionPointer,
  89. &Error
  90. );
  91. }
  92. BOOL
  93. WINAPI
  94. FusionpGetVolumePathNamesForVolumeNameW(
  95. LPCWSTR lpszVolumeName,
  96. LPWSTR lpszVolumePathNames,
  97. DWORD cchBufferLength,
  98. PDWORD lpcchReturnLength
  99. )
  100. {
  101. static PFN_GET_VOLUME_PATHNAMES_FOR_VOLUME_NAME_VOID FunctionPointer;
  102. static DWORD Error;
  103. return FusionpGetVolumePathNamesForVolumeNameGeneric(
  104. lpszVolumeName,
  105. lpszVolumePathNames,
  106. cchBufferLength,
  107. lpcchReturnLength,
  108. "FusionpGetVolumePathNamesForVolumeNameW",
  109. &FunctionPointer,
  110. &Error
  111. );
  112. }
  113. #if defined(__cplusplus)
  114. } /* extern "C" */
  115. #endif