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.

2009 lines
43 KiB

  1. //************************************************************************
  2. //
  3. // dpmffio.c : Dynamic Patch Module for File I/O API family
  4. //
  5. // History:
  6. // 26-jan-02 cmjones created it.
  7. //
  8. //************************************************************************
  9. #ifdef DBG
  10. unsigned long dwLogLevel = 0;
  11. #endif
  12. #include <nt.h>
  13. #include <ntrtl.h>
  14. #include <nturtl.h>
  15. #include <windows.h>
  16. #include "dpmtbls.h"
  17. #include "dpmdbg.h" // include handy debug print macros
  18. #include "shimdb.h"
  19. BOOL DllInitProc(HMODULE hModule, DWORD Reason, PCONTEXT pContext);
  20. PFAMILY_TABLE DpmInitFamTable(PFAMILY_TABLE,
  21. HMODULE,
  22. PVOID,
  23. PVOID,
  24. LPWSTR,
  25. PDPMMODULESETS);
  26. void DpmDestroyFamTable(PFAMILY_TABLE pgDpmFamTbl, PFAMILY_TABLE pFT);
  27. #define GROW_HEAP_AS_NEEDED 0
  28. HANDLE hHeap = NULL;
  29. DWORD dwTlsIndex;
  30. char szShimEngDll[] = "\\ShimEng.dll";
  31. BOOL DllInitProc(HMODULE hModule, DWORD Reason, PCONTEXT pContext)
  32. {
  33. BOOL bRet = TRUE;
  34. UNREFERENCED_PARAMETER(hModule);
  35. UNREFERENCED_PARAMETER(pContext);
  36. switch(Reason) {
  37. case DLL_PROCESS_ATTACH:
  38. if((hHeap = HeapCreate(0, 4096, GROW_HEAP_AS_NEEDED)) == NULL) {
  39. DPMDBGPRN("NTVDM::DpmfFio:Can't initialize heap!\n");
  40. bRet = FALSE;
  41. }
  42. dwTlsIndex = TlsAlloc();
  43. if(dwTlsIndex == TLS_OUT_OF_INDEXES) {
  44. DPMDBGPRN("NTVDM::DpmfFio:Can't initialize TLS!\n");
  45. bRet = FALSE;
  46. }
  47. break;
  48. case DLL_PROCESS_DETACH:
  49. if(hHeap) {
  50. HeapDestroy(hHeap);
  51. }
  52. TlsFree(dwTlsIndex);
  53. break;
  54. }
  55. return bRet;
  56. }
  57. PFAMILY_TABLE DpmInitFamTable(PFAMILY_TABLE pgDpmFamTbl,
  58. HMODULE hMod,
  59. PVOID hSdb,
  60. PVOID pSdbQuery,
  61. LPWSTR pwszAppFilePath,
  62. PDPMMODULESETS pModSet)
  63. {
  64. int i, numApis, len;
  65. PVOID lpdpmfn;
  66. PFAMILY_TABLE pFT = NULL;
  67. PVOID *pFN = NULL;
  68. PVOID *pShimTbl = NULL;
  69. PAPIDESC pApiDesc = NULL;
  70. VDMTABLE VdmTbl;
  71. char szShimEng[MAX_PATH];
  72. HMODULE hModShimEng = NULL;
  73. LPFNSE_SHIMNTVDM lpShimNtvdm;
  74. DPMDBGPRN("NTVDM::DpmfFio:Initialziing File I/O API tables\n");
  75. // Get hooked API count from global table
  76. numApis = pgDpmFamTbl->numHookedAPIs;
  77. // Allocate a new family table
  78. pFT = (PFAMILY_TABLE)HeapAlloc(hHeap,
  79. HEAP_ZERO_MEMORY,
  80. sizeof(FAMILY_TABLE));
  81. if(!pFT) {
  82. DPMDBGPRN("NTVDM::DpmfFio:DpmInit:malloc 1 failed\n");
  83. goto ErrorExit;
  84. }
  85. // Allocate the shim dispatch table for this family in this task
  86. pShimTbl = (PVOID *)HeapAlloc(hHeap,
  87. HEAP_ZERO_MEMORY,
  88. numApis * sizeof(PVOID));
  89. if(!pShimTbl) {
  90. DPMDBGPRN("NTVDM::DpmfFio:DpmInit:malloc 2 failed\n");
  91. goto ErrorExit;
  92. }
  93. pFT->pDpmShmTbls = pShimTbl;
  94. // Allocate an array of ptrs to hooked API's
  95. pFN = (PVOID *)HeapAlloc(hHeap, HEAP_ZERO_MEMORY, numApis * sizeof(PVOID));
  96. if(!pFN) {
  97. DPMDBGPRN("NTVDM::DpmfFio:DpmInit:malloc 3 failed\n");
  98. goto ErrorExit;
  99. }
  100. pFT->pfn = pFN;
  101. pFT->numHookedAPIs = numApis;
  102. pFT->hMod = hMod;
  103. // Allocate a temp array of APIDESC structs to help attach shims
  104. pApiDesc = (PAPIDESC)HeapAlloc(hHeap,
  105. HEAP_ZERO_MEMORY,
  106. numApis * sizeof(APIDESC));
  107. if(!pApiDesc) {
  108. DPMDBGPRN("NTVDM::DpmfFio:DpmInit:malloc 4 failed\n");
  109. goto ErrorExit;
  110. }
  111. VdmTbl.nApiCount = numApis;
  112. VdmTbl.ppfnOrig = pShimTbl;
  113. VdmTbl.pApiDesc = pApiDesc;
  114. // Fill in the family table with ptrs to the patch functions in this DLL.
  115. for(i = 0; i < numApis; i++) {
  116. // must start with 1 since EXPORT ordinals can't be == 0
  117. lpdpmfn = (PVOID)GetProcAddress(hMod, (LPCSTR)MAKELONG(i+1, 0));
  118. if(!lpdpmfn) {
  119. DPMDBGPRN("NTVDM::DpmfFio:DpmInit:Unable to get proc address\n");
  120. goto ErrorExit;
  121. }
  122. // save ptr to the real API in the shim table until it gets shimmed
  123. pShimTbl[i] = pgDpmFamTbl->pfn[i];
  124. // relate the corresponding module and API name to the API function ptr
  125. pApiDesc[i].pszModule = (char *)pModSet->ApiModuleName;
  126. pApiDesc[i].pszApi = (char *)pModSet->ApiNames[i];
  127. // save ptr to the patch function
  128. pFN[i] = lpdpmfn;
  129. }
  130. // Only do this if we need to attach the shim engine.
  131. GetSystemDirectory(szShimEng, MAX_PATH);
  132. strcat(szShimEng, szShimEngDll);
  133. hModShimEng = LoadLibrary(szShimEng);
  134. pFT->hModShimEng = hModShimEng;
  135. if(NULL == hModShimEng) {
  136. DPMDBGPRN("NTVDM::DpmfFio:DpmInit:ShimEng load failed\n");
  137. goto ErrorExit;
  138. }
  139. lpShimNtvdm = (LPFNSE_SHIMNTVDM)GetProcAddress(hModShimEng, "SE_ShimNTVDM");
  140. if(!lpShimNtvdm) {
  141. DPMDBGPRN("NTVDM::DpmfFio:DpmInit:GetProcAddress failed\n");
  142. goto ErrorExit;
  143. }
  144. // Patch the shim dispatch table with the shim function ptrs
  145. // If this fails we will stick with ptrs to the original API's
  146. (lpShimNtvdm)(pwszAppFilePath, hSdb, pSdbQuery, &VdmTbl);
  147. // Do this if you want dispatch directly to the shim functions
  148. // for(i = 0; i < numApis; i++) {
  149. // pFN[i] = pShimTbl[i];
  150. // }
  151. // HeapFree(hHeap, 0, pShimTbl);
  152. // pFT->pDpmShmTbls = NULL;
  153. if(!TlsSetValue(dwTlsIndex, pFT)) {
  154. DPMDBGPRN("NTVDM::DpmfFio:DpmInit:TLS set failed\n");
  155. goto ErrorExit;
  156. }
  157. if(pApiDesc) {
  158. HeapFree(hHeap, 0, pApiDesc);
  159. }
  160. DPMDBGPRN1(" DpmfFio:Returning File I/o API tables: %#lx\n",pFT);
  161. return(pFT);
  162. ErrorExit:
  163. DPMDBGPRN(" DpmfFio:Init failed: Returning NULL\n");
  164. DpmDestroyFamTable(pgDpmFamTbl, pFT);
  165. if(pApiDesc) {
  166. HeapFree(hHeap, 0, pApiDesc);
  167. }
  168. return(NULL);
  169. }
  170. void DpmDestroyFamTable(PFAMILY_TABLE pgDpmFamTbl, PFAMILY_TABLE pFT)
  171. {
  172. PVDM_TIB pVdmTib;
  173. PVOID *pShimTbl;
  174. LPFNSE_REMOVENTVDM lpfnSE_RemoveNtvdmTask = NULL;
  175. DPMDBGPRN("NTVDM::DpmfFio:Destroying File I/O API tables for task\n");
  176. // if this task is using the global table for this family, nothing to do
  177. if(!pFT || pFT == pgDpmFamTbl)
  178. return;
  179. pShimTbl = pFT->pDpmShmTbls;
  180. if(pShimTbl) {
  181. HeapFree(hHeap, 0, pShimTbl);
  182. }
  183. if(pFT->pfn) {
  184. HeapFree(hHeap, 0, pFT->pfn);
  185. }
  186. // See if the shim engine is attached & detach it
  187. if(pFT->hModShimEng) {
  188. lpfnSE_RemoveNtvdmTask =
  189. (LPFNSE_REMOVENTVDM)GetProcAddress(pFT->hModShimEng,
  190. "SE_RemoveNTVDMTask");
  191. if(lpfnSE_RemoveNtvdmTask) {
  192. (lpfnSE_RemoveNtvdmTask)(NtCurrentTeb()->ClientId.UniqueThread);
  193. }
  194. FreeLibrary(pFT->hModShimEng);
  195. }
  196. HeapFree(hHeap, 0, pFT);
  197. }
  198. // ^^^^^^^^^^ All the above should be in every DPM module. ^^^^^^^^^^^^
  199. // vvvvvvvvvv Define module specific stuff below. vvvvvvvvvvvv
  200. HFILE dpmOpenFile(LPCSTR lpFileName,
  201. LPOFSTRUCT lpof,
  202. UINT uStyle)
  203. {
  204. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  205. HFILE ret = 0;
  206. DPMDBGPRN("OpenFile: ");
  207. ret = SHM_OpenFile(lpFileName, lpof, uStyle);
  208. DPMDBGPRN1(" -> %#lx\n", ret);
  209. return(ret);
  210. }
  211. HFILE dpm_lclose(HFILE hFile)
  212. {
  213. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  214. HFILE ret = 0;
  215. DPMDBGPRN("_lclose: ");
  216. ret = SHM__lclose(hFile);
  217. DPMDBGPRN1(" -> %#lx\n", ret);
  218. return(ret);
  219. }
  220. HFILE dpm_lopen(LPCSTR lpPathName, int iReadWrite)
  221. {
  222. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  223. HFILE ret = 0;
  224. DPMDBGPRN("_lopen: ");
  225. ret = SHM__lopen(lpPathName, iReadWrite);
  226. DPMDBGPRN1(" -> %#lx\n", ret);
  227. return(ret);
  228. }
  229. HFILE dpm_lcreat(LPCSTR lpPathName, int iAttribute)
  230. {
  231. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  232. HFILE ret = 0;
  233. DPMDBGPRN("_lcreat: ");
  234. ret = SHM__lcreat(lpPathName, iAttribute);
  235. DPMDBGPRN1(" -> %#lx\n", ret);
  236. return(ret);
  237. }
  238. LONG dpm_llseek(HFILE hFile, LONG lOffset, int iOrigin)
  239. {
  240. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  241. LONG ret = 0;
  242. DPMDBGPRN("_llseek: ");
  243. ret = SHM__llseek(hFile, lOffset, iOrigin);
  244. DPMDBGPRN1(" -> %ld\n", ret);
  245. return(ret);
  246. }
  247. UINT dpm_lread(HFILE hFile, LPVOID lpBuffer, UINT uBytes)
  248. {
  249. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  250. UINT ret = 0;
  251. DPMDBGPRN("_lread: ");
  252. ret = SHM__lread(hFile, lpBuffer, uBytes);
  253. DPMDBGPRN1(" -> %ld\n", ret);
  254. return(ret);
  255. }
  256. UINT dpm_lwrite(HFILE hFile, LPCSTR lpBuffer, UINT uBytes)
  257. {
  258. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  259. UINT ret = 0;
  260. DPMDBGPRN("_lwrite: ");
  261. ret = SHM__lwrite(hFile, lpBuffer, uBytes);
  262. DPMDBGPRN1(" -> %ld\n", ret);
  263. return(ret);
  264. }
  265. long dpm_hread(HFILE hFile, LPVOID lpBuffer, long lBytes)
  266. {
  267. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  268. long ret = 0;
  269. DPMDBGPRN("_hread: ");
  270. ret = SHM__hread(hFile, lpBuffer, lBytes);
  271. DPMDBGPRN1(" -> %ld\n", ret);
  272. return(ret);
  273. }
  274. long dpm_hwrite(HFILE hFile, LPCSTR lpBuffer, long lBytes)
  275. {
  276. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  277. LONG ret = 0;
  278. DPMDBGPRN("_hwrite: ");
  279. ret = SHM__hwrite(hFile, lpBuffer, lBytes);
  280. DPMDBGPRN1(" -> %ld\n", ret);
  281. return(ret);
  282. }
  283. UINT dpmGetTempFileName(LPCSTR lpPathName,
  284. LPCSTR lpPrefixString,
  285. UINT uUnique,
  286. LPSTR lpTempFileName)
  287. {
  288. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  289. LONG ret = 0;
  290. DPMDBGPRN("GetTempFileName: ");
  291. ret = SHM_GetTempFileName(lpPathName, lpPrefixString, uUnique, lpTempFileName);
  292. DPMDBGPRN1(" -> %ld\n", ret);
  293. return(ret);
  294. }
  295. BOOL dpmAreFileApisANSI(VOID)
  296. {
  297. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  298. BOOL ret = 0;
  299. DPMDBGPRN("AreFileApisANSI: ");
  300. ret = SHM_AreFileApisANSI();
  301. DPMDBGPRN1(" -> %#lx\n", ret);
  302. return(ret);
  303. }
  304. BOOL dpmCancelIo(HANDLE hFile)
  305. {
  306. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  307. BOOL ret = 0;
  308. DPMDBGPRN("CancelIo: ");
  309. ret = SHM_CancelIo(hFile);
  310. DPMDBGPRN1(" -> %#lx\n", ret);
  311. return(ret);
  312. }
  313. BOOL dpmCloseHandle(HANDLE hObject)
  314. {
  315. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  316. BOOL ret = 0;
  317. DPMDBGPRN("CloseHandle: ");
  318. ret = SHM_CloseHandle(hObject);
  319. DPMDBGPRN1(" -> %#lx\n", ret);
  320. return(ret);
  321. }
  322. BOOL dpmCopyFile(LPCSTR lpExistingFileName,
  323. LPCSTR lpNewFileName,
  324. BOOL bFailIfExists)
  325. {
  326. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  327. BOOL ret = 0;
  328. DPMDBGPRN("CopyFile: ");
  329. ret = SHM_CopyFile(lpExistingFileName, lpNewFileName, bFailIfExists);
  330. DPMDBGPRN1(" -> %#lx\n", ret);
  331. return(ret);
  332. }
  333. BOOL dpmCopyFileEx(LPCSTR lpExistingFileName,
  334. LPCSTR lpNewFileName,
  335. LPPROGRESS_ROUTINE lpProgressRoutine,
  336. LPVOID lpData,
  337. LPBOOL pbCancel,
  338. DWORD dwCopyFlags)
  339. {
  340. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  341. BOOL ret = 0;
  342. DPMDBGPRN("CopyFileEx: ");
  343. ret = SHM_CopyFileEx(lpExistingFileName,
  344. lpNewFileName,
  345. lpProgressRoutine,
  346. lpData,
  347. pbCancel,
  348. dwCopyFlags);
  349. DPMDBGPRN1(" -> %#lx\n", ret);
  350. return(ret);
  351. }
  352. BOOL dpmCreateDirectory(LPCSTR lpPathName,
  353. LPSECURITY_ATTRIBUTES lpSecurityAttributes)
  354. {
  355. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  356. BOOL ret = 0;
  357. DPMDBGPRN("CreateDirectory: ");
  358. ret = SHM_CreateDirectory(lpPathName, lpSecurityAttributes);
  359. DPMDBGPRN1(" -> %#lx\n", ret);
  360. return(ret);
  361. }
  362. BOOL dpmCreateDirectoryEx(LPCSTR lpTemplateDirectory,
  363. LPCSTR lpNewDirectory,
  364. LPSECURITY_ATTRIBUTES lpSecurityAttributes)
  365. {
  366. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  367. BOOL ret = 0;
  368. DPMDBGPRN("CreateDirectoryEx: ");
  369. ret = SHM_CreateDirectoryEx(lpTemplateDirectory,
  370. lpNewDirectory,
  371. lpSecurityAttributes);
  372. DPMDBGPRN1(" -> %#lx\n", ret);
  373. return(ret);
  374. }
  375. HANDLE dpmCreateFile(LPCSTR lpFileName,
  376. DWORD dwDesiredAccess,
  377. DWORD dwShareMode,
  378. LPSECURITY_ATTRIBUTES lpSecurityAttributes,
  379. DWORD dwCreationDisposition,
  380. DWORD dwFlagsAndAttributes,
  381. HANDLE hTemplateFile)
  382. {
  383. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  384. HANDLE ret = 0;
  385. DPMDBGPRN("CreateFile: ");
  386. ret = SHM_CreateFile(lpFileName,
  387. dwDesiredAccess,
  388. dwShareMode,
  389. lpSecurityAttributes,
  390. dwCreationDisposition,
  391. dwFlagsAndAttributes,
  392. hTemplateFile);
  393. DPMDBGPRN1(" -> %#lx\n", ret);
  394. return(ret);
  395. }
  396. BOOL dpmDeleteFile(LPCSTR lpFileName)
  397. {
  398. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  399. BOOL ret = 0;
  400. DPMDBGPRN("DeleteFile: ");
  401. ret = SHM_DeleteFile(lpFileName);
  402. DPMDBGPRN1(" -> %#lx\n", ret);
  403. return(ret);
  404. }
  405. BOOL dpmFindClose(HANDLE hFindFile)
  406. {
  407. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  408. BOOL ret = 0;
  409. DPMDBGPRN("FindClose: ");
  410. ret = SHM_FindClose(hFindFile);
  411. DPMDBGPRN1(" -> %#lx\n", ret);
  412. return(ret);
  413. }
  414. BOOL dpmFindCloseChangeNotification(HANDLE hChangeHandle)
  415. {
  416. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  417. BOOL ret = 0;
  418. DPMDBGPRN("FindCloseChangeNotification: ");
  419. ret = SHM_FindCloseChangeNotification(hChangeHandle);
  420. DPMDBGPRN1(" -> %#lx\n", ret);
  421. return(ret);
  422. }
  423. HANDLE dpmFindFirstChangeNotification(LPCSTR lpPathName,
  424. BOOL bWatchSubtree,
  425. DWORD dwNotifyFilter)
  426. {
  427. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  428. HANDLE ret = 0;
  429. DPMDBGPRN("FindFirstChangeNotification: ");
  430. ret = SHM_FindFirstChangeNotification(lpPathName,bWatchSubtree,dwNotifyFilter);
  431. DPMDBGPRN1(" -> %#lx\n", ret);
  432. return(ret);
  433. }
  434. HANDLE dpmFindFirstFile(LPCSTR lpFileName, LPWIN32_FIND_DATA lpFindFileData)
  435. {
  436. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  437. HANDLE ret = 0;
  438. DPMDBGPRN("FindFirstFile: ");
  439. ret = SHM_FindFirstFile(lpFileName, lpFindFileData);
  440. DPMDBGPRN1(" -> %#lx\n", ret);
  441. return(ret);
  442. }
  443. BOOL dpmFindNextChangeNotification(HANDLE hChangeHandle)
  444. {
  445. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  446. BOOL ret = 0;
  447. DPMDBGPRN("FindNextChangeNotification: ");
  448. ret = SHM_FindNextChangeNotification(hChangeHandle);
  449. DPMDBGPRN1(" -> %#lx\n", ret);
  450. return(ret);
  451. }
  452. BOOL dpmFindNextFile(HANDLE hFindFile, LPWIN32_FIND_DATA lpFindFileData)
  453. {
  454. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  455. BOOL ret = 0;
  456. DPMDBGPRN("FindNextFile: ");
  457. ret = SHM_FindNextFile(hFindFile, lpFindFileData);
  458. DPMDBGPRN1(" -> %#lx\n", ret);
  459. return(ret);
  460. }
  461. BOOL dpmFlushFileBuffers(HANDLE hFile)
  462. {
  463. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  464. BOOL ret = 0;
  465. DPMDBGPRN("FlushFileBuffers: ");
  466. ret = SHM_FlushFileBuffers(hFile);
  467. DPMDBGPRN1(" -> %#lx\n", ret);
  468. return(ret);
  469. }
  470. DWORD dpmGetCurrentDirectory(DWORD nBufferLength, LPSTR lpBuffer)
  471. {
  472. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  473. DWORD ret = 0;
  474. DPMDBGPRN("GetCurrentDirectory: ");
  475. ret = SHM_GetCurrentDirectory(nBufferLength, lpBuffer);
  476. DPMDBGPRN1(" -> %#lx\n", ret);
  477. return(ret);
  478. }
  479. BOOL dpmGetDiskFreeSpace(LPCSTR lpRootPathName,
  480. LPDWORD lpSectorsPerCluster,
  481. LPDWORD lpBytesPerSector,
  482. LPDWORD lpNumberOfFreeClusters,
  483. LPDWORD lpTotalNumberOfClusters)
  484. {
  485. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  486. BOOL ret = 0;
  487. DPMDBGPRN("GetDiskFreeSpace: ");
  488. ret = SHM_GetDiskFreeSpace(lpRootPathName,
  489. lpSectorsPerCluster,
  490. lpBytesPerSector,
  491. lpNumberOfFreeClusters,
  492. lpTotalNumberOfClusters);
  493. DPMDBGPRN1(" -> %#lx\n", ret);
  494. return(ret);
  495. }
  496. BOOL dpmGetDiskFreeSpaceEx(LPCSTR lpDirectoryName,
  497. PULARGE_INTEGER lpFreeBytesAvailable,
  498. PULARGE_INTEGER lpTotalNumberOfBytes,
  499. PULARGE_INTEGER lpTotalNumberOfFreeBytes)
  500. {
  501. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  502. BOOL ret = 0;
  503. DPMDBGPRN("GetDiskFreeSpaceEx: ");
  504. ret = SHM_GetDiskFreeSpaceEx(lpDirectoryName,
  505. lpFreeBytesAvailable,
  506. lpTotalNumberOfBytes,
  507. lpTotalNumberOfFreeBytes);
  508. DPMDBGPRN1(" -> %#lx\n", ret);
  509. return(ret);
  510. }
  511. UINT dpmGetDriveType(LPCSTR lpRootPathName)
  512. {
  513. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  514. UINT ret = 0;
  515. DPMDBGPRN("GetDriveType: ");
  516. ret = SHM_GetDriveType(lpRootPathName);
  517. DPMDBGPRN1(" -> %#lx\n", ret);
  518. return(ret);
  519. }
  520. DWORD dpmGetFileAttributes(LPCSTR lpFileName)
  521. {
  522. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  523. DWORD ret = 0;
  524. DPMDBGPRN("GetFileAttributes: ");
  525. ret = SHM_GetFileAttributes(lpFileName);
  526. DPMDBGPRN1(" -> %#lx\n", ret);
  527. return(ret);
  528. }
  529. BOOL dpmGetFileAttributesEx(LPCSTR lpFileName,
  530. GET_FILEEX_INFO_LEVELS fInfoLevelId,
  531. LPVOID lpFileInformation)
  532. {
  533. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  534. BOOL ret = 0;
  535. DPMDBGPRN("GetFileAttributesEx: ");
  536. ret = SHM_GetFileAttributesEx(lpFileName,
  537. fInfoLevelId,
  538. lpFileInformation);
  539. DPMDBGPRN1(" -> %#lx\n", ret);
  540. return(ret);
  541. }
  542. BOOL dpmGetFileInformationByHandle(HANDLE hFile,
  543. LPBY_HANDLE_FILE_INFORMATION lpFileInformation)
  544. {
  545. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  546. BOOL ret = 0;
  547. DPMDBGPRN("GetFileInformationByHandle: ");
  548. ret = SHM_GetFileInformationByHandle(hFile, lpFileInformation);
  549. DPMDBGPRN1(" -> %#lx\n", ret);
  550. return(ret);
  551. }
  552. DWORD dpmGetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh)
  553. {
  554. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  555. DWORD ret = 0;
  556. DPMDBGPRN("GetFileSize: ");
  557. ret = SHM_GetFileSize(hFile, lpFileSizeHigh);
  558. DPMDBGPRN1(" -> %#lx\n", ret);
  559. return(ret);
  560. }
  561. DWORD dpmGetFileType(HANDLE hFile)
  562. {
  563. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  564. DWORD ret = 0;
  565. DPMDBGPRN("GetFileType: ");
  566. ret = SHM_GetFileType(hFile);
  567. DPMDBGPRN1(" -> %#lx\n", ret);
  568. return(ret);
  569. }
  570. DWORD dpmGetFullPathName(LPCSTR lpFileName,
  571. DWORD nBufferLength,
  572. LPSTR lpBuffer,
  573. LPSTR *lpFilePart)
  574. {
  575. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  576. DWORD ret = 0;
  577. DPMDBGPRN("GetFullPathName: ");
  578. ret = SHM_GetFullPathName(lpFileName,
  579. nBufferLength,
  580. lpBuffer,
  581. lpFilePart);
  582. DPMDBGPRN1(" -> %#lx\n", ret);
  583. return(ret);
  584. }
  585. DWORD dpmGetLogicalDrives(VOID)
  586. {
  587. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  588. DWORD ret = 0;
  589. DPMDBGPRN("GetLogicalDrives: ");
  590. ret = SHM_GetLogicalDrives();
  591. DPMDBGPRN(" -> void return\n");
  592. return(ret);
  593. }
  594. DWORD dpmGetLogicalDriveStrings(DWORD nBufferLength, LPSTR lpBuffer)
  595. {
  596. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  597. DWORD ret = 0;
  598. DPMDBGPRN("GetLogicalDriveStrings: ");
  599. ret = SHM_GetLogicalDriveStrings(nBufferLength, lpBuffer);
  600. DPMDBGPRN1(" -> %#lx\n", ret);
  601. return(ret);
  602. }
  603. DWORD dpmGetLongPathName(LPCSTR lpszShortPath,
  604. LPSTR lpszLongPath,
  605. DWORD cchBuffer)
  606. {
  607. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  608. DWORD ret = 0;
  609. DPMDBGPRN("GetLongPathName: ");
  610. ret = SHM_GetLongPathName(lpszShortPath,
  611. lpszLongPath,
  612. cchBuffer);
  613. DPMDBGPRN1(" -> %#lx\n", ret);
  614. return(ret);
  615. }
  616. DWORD dpmGetShortPathName(LPCSTR lpszLongPath,
  617. LPSTR lpszShortPath,
  618. DWORD cchBuffer)
  619. {
  620. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  621. DWORD ret = 0;
  622. DPMDBGPRN("GetShortPathName: ");
  623. ret = SHM_GetShortPathName(lpszLongPath,
  624. lpszShortPath,
  625. cchBuffer);
  626. DPMDBGPRN1(" -> %#lx\n", ret);
  627. return(ret);
  628. }
  629. DWORD dpmGetTempPath(DWORD nBufferLength, LPSTR lpBuffer)
  630. {
  631. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  632. DWORD ret = 0;
  633. DPMDBGPRN("GetTempPath: ");
  634. ret = SHM_GetTempPath(nBufferLength, lpBuffer);
  635. DPMDBGPRN1(" -> %#lx\n", ret);
  636. return(ret);
  637. }
  638. BOOL dpmLockFile(HANDLE hFile,
  639. DWORD dwFileOffsetLow,
  640. DWORD dwFileOffsetHigh,
  641. DWORD nNumberOfBytesToLockLow,
  642. DWORD nNumberOfBytesToLockHigh)
  643. {
  644. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  645. BOOL ret = 0;
  646. DPMDBGPRN("LockFile: ");
  647. ret = SHM_LockFile(hFile,
  648. dwFileOffsetLow,
  649. dwFileOffsetHigh,
  650. nNumberOfBytesToLockLow,
  651. nNumberOfBytesToLockHigh);
  652. DPMDBGPRN1(" -> %#lx\n", ret);
  653. return(ret);
  654. }
  655. BOOL dpmMoveFile(LPCSTR lpExistingFileName,
  656. LPCSTR lpNewFileName)
  657. {
  658. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  659. BOOL ret = 0;
  660. DPMDBGPRN("MoveFile: ");
  661. ret = SHM_MoveFile(lpExistingFileName, lpNewFileName);
  662. DPMDBGPRN1(" -> %#lx\n", ret);
  663. return(ret);
  664. }
  665. BOOL dpmMoveFileEx(LPCSTR lpExistingFileName,
  666. LPCSTR lpNewFileName,
  667. DWORD dwFlags)
  668. {
  669. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  670. BOOL ret = 0;
  671. DPMDBGPRN("MoveFileEx: ");
  672. ret = SHM_MoveFileEx(lpExistingFileName, lpNewFileName, dwFlags);
  673. DPMDBGPRN1(" -> %#lx\n", ret);
  674. return(ret);
  675. }
  676. DWORD dpmQueryDosDevice(LPCSTR lpDeviceName,
  677. LPSTR lpTargetPath,
  678. DWORD ucchMax)
  679. {
  680. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  681. DWORD ret = 0;
  682. DPMDBGPRN("QueryDosDevice: ");
  683. ret = SHM_QueryDosDevice(lpDeviceName, lpTargetPath, ucchMax);
  684. DPMDBGPRN1(" -> %#lx\n", ret);
  685. return(ret);
  686. }
  687. BOOL dpmReadFile(HANDLE hFile,
  688. LPVOID lpBuffer,
  689. DWORD nNumberOfBytesToRead,
  690. LPDWORD lpNumberOfBytesRead,
  691. LPOVERLAPPED lpOverlapped)
  692. {
  693. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  694. BOOL ret = 0;
  695. DPMDBGPRN("ReadFile: ");
  696. ret = SHM_ReadFile(hFile,
  697. lpBuffer,
  698. nNumberOfBytesToRead,
  699. lpNumberOfBytesRead,
  700. lpOverlapped);
  701. DPMDBGPRN1(" -> %#lx\n", ret);
  702. return(ret);
  703. }
  704. BOOL dpmReadFileEx(HANDLE hFile,
  705. LPVOID lpBuffer,
  706. DWORD nNumberOfBytesToRead,
  707. LPOVERLAPPED lpOverlapped,
  708. LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine)
  709. {
  710. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  711. BOOL ret = 0;
  712. DPMDBGPRN("ReadFileEx: ");
  713. ret = SHM_ReadFileEx(hFile,
  714. lpBuffer,
  715. nNumberOfBytesToRead,
  716. lpOverlapped,
  717. lpCompletionRoutine);
  718. DPMDBGPRN1(" -> %#lx\n", ret);
  719. return(ret);
  720. }
  721. BOOL dpmRemoveDirectory(LPCSTR lpPathName)
  722. {
  723. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  724. BOOL ret = 0;
  725. DPMDBGPRN("RemoveDirectory: ");
  726. ret = SHM_RemoveDirectory(lpPathName);
  727. DPMDBGPRN1(" -> %#lx\n", ret);
  728. return(ret);
  729. }
  730. DWORD dpmSearchPath(LPCSTR lpPath,
  731. LPCSTR lpFileName,
  732. LPCSTR lpExtension,
  733. DWORD nBufferLength,
  734. LPSTR lpBuffer,
  735. LPSTR *lpFilePart)
  736. {
  737. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  738. DWORD ret = 0;
  739. DPMDBGPRN("SearchPath: ");
  740. ret = SHM_SearchPath(lpPath,
  741. lpFileName,
  742. lpExtension,
  743. nBufferLength,
  744. lpBuffer,
  745. lpFilePart);
  746. DPMDBGPRN1(" -> %#lx\n", ret);
  747. return(ret);
  748. }
  749. BOOL dpmSetCurrentDirectory(LPCSTR lpPathName)
  750. {
  751. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  752. BOOL ret = 0;
  753. DPMDBGPRN("SetCurrentDirectory: ");
  754. ret = SHM_SetCurrentDirectory(lpPathName);
  755. DPMDBGPRN1(" -> %#lx\n", ret);
  756. return(ret);
  757. }
  758. BOOL dpmSetEndOfFile(HANDLE hFile)
  759. {
  760. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  761. BOOL ret = 0;
  762. DPMDBGPRN("SetEndOfFile: ");
  763. ret = SHM_SetEndOfFile(hFile);
  764. DPMDBGPRN1(" -> %#lx\n", ret);
  765. return(ret);
  766. }
  767. VOID dpmSetFileApisToANSI(VOID)
  768. {
  769. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  770. DPMDBGPRN("SetFileApisToANSI: ");
  771. SetFileApisToANSI();
  772. DPMDBGPRN(" -> Void return");
  773. }
  774. VOID dpmSetFileApisToOEM(VOID)
  775. {
  776. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  777. DPMDBGPRN("SetFileApisToOEM: ");
  778. SetFileApisToOEM();
  779. DPMDBGPRN(" -> Void return");
  780. }
  781. BOOL dpmSetFileAttributes(LPCSTR lpFileName, DWORD dwFileAttributes)
  782. {
  783. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  784. BOOL ret = 0;
  785. DPMDBGPRN("SetFileAttributes: ");
  786. ret = SHM_SetFileAttributes(lpFileName, dwFileAttributes);
  787. DPMDBGPRN1(" -> %#lx\n", ret);
  788. return(ret);
  789. }
  790. DWORD dpmSetFilePointer(HANDLE hFile,
  791. LONG lDistanceToMove,
  792. PLONG lpDistanceToMoveHigh,
  793. DWORD dwMoveMethod)
  794. {
  795. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  796. DWORD ret = 0;
  797. DPMDBGPRN("SetFilePointer: ");
  798. ret = SHM_SetFilePointer(hFile,
  799. lDistanceToMove,
  800. lpDistanceToMoveHigh,
  801. dwMoveMethod);
  802. DPMDBGPRN1(" -> %#lx\n", ret);
  803. return(ret);
  804. }
  805. BOOL dpmSetVolumeLabel(LPCSTR lpRootPathName, LPCSTR lpVolumeName)
  806. {
  807. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  808. BOOL ret = 0;
  809. DPMDBGPRN("SetVolumeLabel: ");
  810. ret = SHM_SetVolumeLabel(lpRootPathName, lpVolumeName);
  811. DPMDBGPRN1(" -> %#lx\n", ret);
  812. return(ret);
  813. }
  814. BOOL dpmUnlockFile(HANDLE hFile,
  815. DWORD dwFileOffsetLow,
  816. DWORD dwFileOffsetHigh,
  817. DWORD nNumberOfBytesToUnlockLow,
  818. DWORD nNumberOfBytesToUnlockHigh)
  819. {
  820. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  821. BOOL ret = 0;
  822. DPMDBGPRN("UnlockFile: ");
  823. ret = SHM_UnlockFile(hFile,
  824. dwFileOffsetLow,
  825. dwFileOffsetHigh,
  826. nNumberOfBytesToUnlockLow,
  827. nNumberOfBytesToUnlockHigh);
  828. DPMDBGPRN1(" -> %#lx\n", ret);
  829. return(ret);
  830. }
  831. BOOL dpmWriteFile(HANDLE hFile,
  832. LPCVOID lpBuffer,
  833. DWORD nNumberOfBytesToWrite,
  834. LPDWORD lpNumberOfBytesWritten,
  835. LPOVERLAPPED lpOverlapped)
  836. {
  837. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  838. BOOL ret = 0;
  839. DPMDBGPRN("WriteFile: ");
  840. ret = SHM_WriteFile(hFile,
  841. lpBuffer,
  842. nNumberOfBytesToWrite,
  843. lpNumberOfBytesWritten,
  844. lpOverlapped);
  845. DPMDBGPRN1(" -> %#lx\n", ret);
  846. return(ret);
  847. }
  848. BOOL dpmWriteFileEx(HANDLE hFile,
  849. LPCVOID lpBuffer,
  850. DWORD nNumberOfBytesToWrite,
  851. LPOVERLAPPED lpOverlapped,
  852. LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine)
  853. {
  854. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  855. BOOL ret = 0;
  856. DPMDBGPRN("WriteFileEx: ");
  857. ret = SHM_WriteFileEx(hFile,
  858. lpBuffer,
  859. nNumberOfBytesToWrite,
  860. lpOverlapped,
  861. lpCompletionRoutine);
  862. DPMDBGPRN1(" -> %#lx\n", ret);
  863. return(ret);
  864. }
  865. /*
  866. VOID CALLBACK dpmFileIOCompletionRoutine(DWORD dwErrorCode,
  867. DWORD dwNumberOfBytesTransfered,
  868. LPOVERLAPPED lpOverlapped)
  869. {
  870. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  871. DPMDBGPRN("FileIOCompletionRoutine: ");
  872. FileIOCompletionRoutine(dwErrorCode,
  873. dwNumberOfBytesTransfered,
  874. lpOverlapped);
  875. DPMDBGPRN(" -> void return\n");
  876. }
  877. */
  878. UINT dpmGetTempFileNameW(LPCWSTR lpPathName,
  879. LPCWSTR lpPrefixString,
  880. UINT uUnique,
  881. LPWSTR lpTempFileName)
  882. {
  883. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  884. LONG ret = 0;
  885. DPMDBGPRN("GetTempFileNameW: ");
  886. ret = SHM_GetTempFileNameW(lpPathName, lpPrefixString, uUnique, lpTempFileName);
  887. DPMDBGPRN1(" -> %ld\n", ret);
  888. return(ret);
  889. }
  890. BOOL dpmCopyFileW(LPCWSTR lpExistingFileName,
  891. LPCWSTR lpNewFileName,
  892. BOOL bFailIfExists)
  893. {
  894. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  895. BOOL ret = 0;
  896. DPMDBGPRN("CopyFileW: ");
  897. ret = SHM_CopyFileW(lpExistingFileName, lpNewFileName, bFailIfExists);
  898. DPMDBGPRN1(" -> %#lx\n", ret);
  899. return(ret);
  900. }
  901. BOOL dpmCopyFileExW(LPCWSTR lpExistingFileName,
  902. LPCWSTR lpNewFileName,
  903. LPPROGRESS_ROUTINE lpProgressRoutine,
  904. LPVOID lpData,
  905. LPBOOL pbCancel,
  906. DWORD dwCopyFlags)
  907. {
  908. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  909. BOOL ret = 0;
  910. DPMDBGPRN("CopyFileExW: ");
  911. ret = SHM_CopyFileExW(lpExistingFileName,
  912. lpNewFileName,
  913. lpProgressRoutine,
  914. lpData,
  915. pbCancel,
  916. dwCopyFlags);
  917. DPMDBGPRN1(" -> %#lx\n", ret);
  918. return(ret);
  919. }
  920. BOOL dpmCreateDirectoryW(LPCWSTR lpPathName,
  921. LPSECURITY_ATTRIBUTES lpSecurityAttributes)
  922. {
  923. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  924. BOOL ret = 0;
  925. DPMDBGPRN("CreateDirectoryW: ");
  926. ret = SHM_CreateDirectoryW(lpPathName, lpSecurityAttributes);
  927. DPMDBGPRN1(" -> %#lx\n", ret);
  928. return(ret);
  929. }
  930. BOOL dpmCreateDirectoryExW(LPCWSTR lpTemplateDirectory,
  931. LPCWSTR lpNewDirectory,
  932. LPSECURITY_ATTRIBUTES lpSecurityAttributes)
  933. {
  934. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  935. BOOL ret = 0;
  936. DPMDBGPRN("CreateDirectoryExW: ");
  937. ret = SHM_CreateDirectoryExW(lpTemplateDirectory,
  938. lpNewDirectory,
  939. lpSecurityAttributes);
  940. DPMDBGPRN1(" -> %#lx\n", ret);
  941. return(ret);
  942. }
  943. HANDLE dpmCreateFileW(LPCWSTR lpFileName,
  944. DWORD dwDesiredAccess,
  945. DWORD dwShareMode,
  946. LPSECURITY_ATTRIBUTES lpSecurityAttributes,
  947. DWORD dwCreationDisposition,
  948. DWORD dwFlagsAndAttributes,
  949. HANDLE hTemplateFile)
  950. {
  951. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  952. HANDLE ret = 0;
  953. DPMDBGPRN("CreateFileW: ");
  954. ret = SHM_CreateFileW(lpFileName,
  955. dwDesiredAccess,
  956. dwShareMode,
  957. lpSecurityAttributes,
  958. dwCreationDisposition,
  959. dwFlagsAndAttributes,
  960. hTemplateFile);
  961. DPMDBGPRN1(" -> %#lx\n", ret);
  962. return(ret);
  963. }
  964. BOOL dpmDeleteFileW(LPCWSTR lpFileName)
  965. {
  966. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  967. BOOL ret = 0;
  968. DPMDBGPRN("DeleteFileW: ");
  969. ret = SHM_DeleteFileW(lpFileName);
  970. DPMDBGPRN1(" -> %#lx\n", ret);
  971. return(ret);
  972. }
  973. HANDLE dpmFindFirstFileW(LPCWSTR lpFileName, LPWIN32_FIND_DATAW lpFindFileData)
  974. {
  975. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  976. HANDLE ret = 0;
  977. DPMDBGPRN("FindFirstFileW: ");
  978. ret = SHM_FindFirstFileW(lpFileName, lpFindFileData);
  979. DPMDBGPRN1(" -> %#lx\n", ret);
  980. return(ret);
  981. }
  982. BOOL dpmFindNextFileW(HANDLE hFindFile, LPWIN32_FIND_DATAW lpFindFileData)
  983. {
  984. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  985. BOOL ret = 0;
  986. DPMDBGPRN("FindNextFileW: ");
  987. ret = SHM_FindNextFileW(hFindFile, lpFindFileData);
  988. DPMDBGPRN1(" -> %#lx\n", ret);
  989. return(ret);
  990. }
  991. DWORD dpmGetCurrentDirectoryW(DWORD nBufferLength, LPWSTR lpBuffer)
  992. {
  993. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  994. DWORD ret = 0;
  995. DPMDBGPRN("GetCurrentDirectoryW: ");
  996. ret = SHM_GetCurrentDirectoryW(nBufferLength, lpBuffer);
  997. DPMDBGPRN1(" -> %#lx\n", ret);
  998. return(ret);
  999. }
  1000. BOOL dpmGetDiskFreeSpaceW(LPCWSTR lpRootPathName,
  1001. LPDWORD lpSectorsPerCluster,
  1002. LPDWORD lpBytesPerSector,
  1003. LPDWORD lpNumberOfFreeClusters,
  1004. LPDWORD lpTotalNumberOfClusters)
  1005. {
  1006. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  1007. BOOL ret = 0;
  1008. DPMDBGPRN("GetDiskFreeSpaceW: ");
  1009. ret = SHM_GetDiskFreeSpaceW(lpRootPathName,
  1010. lpSectorsPerCluster,
  1011. lpBytesPerSector,
  1012. lpNumberOfFreeClusters,
  1013. lpTotalNumberOfClusters);
  1014. DPMDBGPRN1(" -> %#lx\n", ret);
  1015. return(ret);
  1016. }
  1017. BOOL dpmGetDiskFreeSpaceExW(LPCWSTR lpDirectoryName,
  1018. PULARGE_INTEGER lpFreeBytesAvailable,
  1019. PULARGE_INTEGER lpTotalNumberOfBytes,
  1020. PULARGE_INTEGER lpTotalNumberOfFreeBytes)
  1021. {
  1022. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  1023. BOOL ret = 0;
  1024. DPMDBGPRN("GetDiskFreeSpaceExW: ");
  1025. ret = SHM_GetDiskFreeSpaceExW(lpDirectoryName,
  1026. lpFreeBytesAvailable,
  1027. lpTotalNumberOfBytes,
  1028. lpTotalNumberOfFreeBytes);
  1029. DPMDBGPRN1(" -> %#lx\n", ret);
  1030. return(ret);
  1031. }
  1032. UINT dpmGetDriveTypeW(LPCWSTR lpRootPathName)
  1033. {
  1034. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  1035. UINT ret = 0;
  1036. DPMDBGPRN("GetDriveTypeW: ");
  1037. ret = SHM_GetDriveTypeW(lpRootPathName);
  1038. DPMDBGPRN1(" -> %#lx\n", ret);
  1039. return(ret);
  1040. }
  1041. DWORD dpmGetFileAttributesW(LPCWSTR lpFileName)
  1042. {
  1043. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  1044. DWORD ret = 0;
  1045. DPMDBGPRN("GetFileAttributesW: ");
  1046. ret = SHM_GetFileAttributesW(lpFileName);
  1047. DPMDBGPRN1(" -> %#lx\n", ret);
  1048. return(ret);
  1049. }
  1050. BOOL dpmGetFileAttributesExW(LPCWSTR lpFileName,
  1051. GET_FILEEX_INFO_LEVELS fInfoLevelId,
  1052. LPVOID lpFileInformation)
  1053. {
  1054. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  1055. BOOL ret = 0;
  1056. DPMDBGPRN("GetFileAttributesExW: ");
  1057. ret = SHM_GetFileAttributesExW(lpFileName,
  1058. fInfoLevelId,
  1059. lpFileInformation);
  1060. DPMDBGPRN1(" -> %#lx\n", ret);
  1061. return(ret);
  1062. }
  1063. DWORD dpmGetFullPathNameW(LPCWSTR lpFileName,
  1064. DWORD nBufferLength,
  1065. LPWSTR lpBuffer,
  1066. LPWSTR *lpFilePart)
  1067. {
  1068. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  1069. DWORD ret = 0;
  1070. DPMDBGPRN("GetFullPathNameW: ");
  1071. ret = SHM_GetFullPathNameW(lpFileName,
  1072. nBufferLength,
  1073. lpBuffer,
  1074. lpFilePart);
  1075. DPMDBGPRN1(" -> %#lx\n", ret);
  1076. return(ret);
  1077. }
  1078. DWORD dpmGetLogicalDriveStringsW(DWORD nBufferLength, LPWSTR lpBuffer)
  1079. {
  1080. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  1081. DWORD ret = 0;
  1082. DPMDBGPRN("GetLogicalDriveStringsW: ");
  1083. ret = SHM_GetLogicalDriveStringsW(nBufferLength, lpBuffer);
  1084. DPMDBGPRN1(" -> %#lx\n", ret);
  1085. return(ret);
  1086. }
  1087. DWORD dpmGetLongPathNameW(LPCWSTR lpszShortPath,
  1088. LPWSTR lpszLongPath,
  1089. DWORD cchBuffer)
  1090. {
  1091. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  1092. DWORD ret = 0;
  1093. DPMDBGPRN("GetLongPathNameW: ");
  1094. ret = SHM_GetLongPathNameW(lpszShortPath,
  1095. lpszLongPath,
  1096. cchBuffer);
  1097. DPMDBGPRN1(" -> %#lx\n", ret);
  1098. return(ret);
  1099. }
  1100. DWORD dpmGetShortPathNameW(LPCWSTR lpszLongPath,
  1101. LPWSTR lpszShortPath,
  1102. DWORD cchBuffer)
  1103. {
  1104. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  1105. DWORD ret = 0;
  1106. DPMDBGPRN("GetShortPathNameW: ");
  1107. ret = SHM_GetShortPathNameW(lpszLongPath,
  1108. lpszShortPath,
  1109. cchBuffer);
  1110. DPMDBGPRN1(" -> %#lx\n", ret);
  1111. return(ret);
  1112. }
  1113. DWORD dpmGetTempPathW(DWORD nBufferLength, LPWSTR lpBuffer)
  1114. {
  1115. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  1116. DWORD ret = 0;
  1117. DPMDBGPRN("GetTempPathW: ");
  1118. ret = SHM_GetTempPathW(nBufferLength, lpBuffer);
  1119. DPMDBGPRN1(" -> %#lx\n", ret);
  1120. return(ret);
  1121. }
  1122. BOOL dpmMoveFileW(LPCWSTR lpExistingFileName, LPCWSTR lpNewFileName)
  1123. {
  1124. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  1125. BOOL ret = 0;
  1126. DPMDBGPRN("MoveFileW: ");
  1127. ret = SHM_MoveFileW(lpExistingFileName, lpNewFileName);
  1128. DPMDBGPRN1(" -> %#lx\n", ret);
  1129. return(ret);
  1130. }
  1131. BOOL dpmMoveFileExW(LPCWSTR lpExistingFileName,
  1132. LPCWSTR lpNewFileName,
  1133. DWORD dwFlags)
  1134. {
  1135. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  1136. BOOL ret = 0;
  1137. DPMDBGPRN("MoveFileExW: ");
  1138. ret = SHM_MoveFileExW(lpExistingFileName, lpNewFileName, dwFlags);
  1139. DPMDBGPRN1(" -> %#lx\n", ret);
  1140. return(ret);
  1141. }
  1142. DWORD dpmQueryDosDeviceW(LPCWSTR lpDeviceName,
  1143. LPWSTR lpTargetPath,
  1144. DWORD ucchMax)
  1145. {
  1146. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  1147. DWORD ret = 0;
  1148. DPMDBGPRN("QueryDosDeviceW: ");
  1149. ret = SHM_QueryDosDeviceW(lpDeviceName, lpTargetPath, ucchMax);
  1150. DPMDBGPRN1(" -> %#lx\n", ret);
  1151. return(ret);
  1152. }
  1153. BOOL dpmRemoveDirectoryW(LPCWSTR lpPathName)
  1154. {
  1155. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  1156. BOOL ret = 0;
  1157. DPMDBGPRN("RemoveDirectoryW: ");
  1158. ret = SHM_RemoveDirectoryW(lpPathName);
  1159. DPMDBGPRN1(" -> %#lx\n", ret);
  1160. return(ret);
  1161. }
  1162. DWORD dpmSearchPathW(LPCWSTR lpPath,
  1163. LPCWSTR lpFileName,
  1164. LPCWSTR lpExtension,
  1165. DWORD nBufferLength,
  1166. LPWSTR lpBuffer,
  1167. LPWSTR *lpFilePart)
  1168. {
  1169. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  1170. DWORD ret = 0;
  1171. DPMDBGPRN("SearchPathW: ");
  1172. ret = SHM_SearchPathW(lpPath,
  1173. lpFileName,
  1174. lpExtension,
  1175. nBufferLength,
  1176. lpBuffer,
  1177. lpFilePart);
  1178. DPMDBGPRN1(" -> %#lx\n", ret);
  1179. return(ret);
  1180. }
  1181. BOOL dpmSetCurrentDirectoryW(LPCWSTR lpPathName)
  1182. {
  1183. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  1184. BOOL ret = 0;
  1185. DPMDBGPRN("SetCurrentDirectoryW: ");
  1186. ret = SHM_SetCurrentDirectoryW(lpPathName);
  1187. DPMDBGPRN1(" -> %#lx\n", ret);
  1188. return(ret);
  1189. }
  1190. BOOL dpmSetFileAttributesW(LPCWSTR lpFileName, DWORD dwFileAttributes)
  1191. {
  1192. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  1193. BOOL ret = 0;
  1194. DPMDBGPRN("SetFileAttributesW: ");
  1195. ret = SHM_SetFileAttributesW(lpFileName, dwFileAttributes);
  1196. DPMDBGPRN1(" -> %#lx\n", ret);
  1197. return(ret);
  1198. }
  1199. BOOL dpmSetVolumeLabelW(LPCWSTR lpRootPathName, LPCWSTR lpVolumeName)
  1200. {
  1201. PFAMILY_TABLE pFT = (PFAMILY_TABLE)TlsGetValue(dwTlsIndex);
  1202. BOOL ret = 0;
  1203. DPMDBGPRN("SetVolumeLabelW: ");
  1204. ret = SHM_SetVolumeLabelW(lpRootPathName, lpVolumeName);
  1205. DPMDBGPRN1(" -> %#lx\n", ret);
  1206. return(ret);
  1207. }