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.

526 lines
9.9 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. dllentry.c
  5. Abstract:
  6. Module's entry points.
  7. Author:
  8. Ovidiu Temereanca (ovidiut) 02-Jul-2000 Initial implementation
  9. Revision History:
  10. --*/
  11. #include "pch.h"
  12. //
  13. // Implementation
  14. //
  15. //static CRITICAL_SECTION g_csHw;
  16. BOOL
  17. WINAPI
  18. HwdbInitializeA (
  19. IN PCSTR TempDir
  20. )
  21. {
  22. BOOL b;
  23. DEBUGMSG ((DBG_VERBOSE, "HwdbInitializeA(%s): entering (TID=%u)", TempDir, GetCurrentThreadId ()));
  24. // EnterCriticalSection (&g_csHw);
  25. b = HwdbpInitialize (TempDir);
  26. // LeaveCriticalSection (&g_csHw);
  27. DEBUGMSG ((DBG_VERBOSE, "HwdbInitializeA: leaving (b=%u, rc=%u)", b, GetLastError ()));
  28. return b;
  29. }
  30. BOOL
  31. WINAPI
  32. HwdbInitializeW (
  33. IN PCWSTR TempDir
  34. )
  35. {
  36. BOOL b;
  37. PCSTR ansi = ConvertToAnsiSz (TempDir);
  38. DEBUGMSG ((DBG_VERBOSE, "HwdbInitializeW(%s): entering (TID=%u)", TempDir, GetCurrentThreadId ()));
  39. // EnterCriticalSection (&g_csHw);
  40. b = HwdbpInitialize (ansi);
  41. // LeaveCriticalSection (&g_csHw);
  42. FreeString (ansi);
  43. DEBUGMSG ((DBG_VERBOSE, "HwdbInitializeW: leaving (b=%u, rc=%u)", b, GetLastError ()));
  44. return b;
  45. }
  46. VOID
  47. WINAPI
  48. HwdbTerminate (
  49. VOID
  50. )
  51. {
  52. // EnterCriticalSection (&g_csHw);
  53. DEBUGMSG ((DBG_VERBOSE, "HwdbTerminate(): entering (TID=%u)", GetCurrentThreadId ()));
  54. HwdbpTerminate ();
  55. DEBUGMSG ((DBG_VERBOSE, "HwdbTerminate(): leaving"));
  56. // LeaveCriticalSection (&g_csHw);
  57. }
  58. HANDLE
  59. WINAPI
  60. HwdbOpenA (
  61. IN PCSTR DatabaseFile OPTIONAL
  62. )
  63. {
  64. PHWDB p;
  65. // EnterCriticalSection (&g_csHw);
  66. DEBUGMSG ((DBG_VERBOSE, "HwdbOpenA(%s): entering (TID=%u)", DatabaseFile, GetCurrentThreadId ()));
  67. p = HwdbpOpen (DatabaseFile);
  68. DEBUGMSG ((DBG_VERBOSE, "HwdbOpenA: leaving (p=%p, rc=%u)", p, GetLastError ()));
  69. // LeaveCriticalSection (&g_csHw);
  70. return (HANDLE)p;
  71. }
  72. HANDLE
  73. WINAPI
  74. HwdbOpenW (
  75. IN PCWSTR DatabaseFile OPTIONAL
  76. )
  77. {
  78. PHWDB p;
  79. PCSTR ansi = ConvertToAnsiSz (DatabaseFile);
  80. DEBUGMSG ((DBG_VERBOSE, "HwdbInitializeW(%s): entering (TID=%u)", DatabaseFile, GetCurrentThreadId ()));
  81. // EnterCriticalSection (&g_csHw);
  82. DEBUGMSG ((DBG_VERBOSE, "HwdbOpenW(%s): entering (TID=%u)", DatabaseFile, GetCurrentThreadId ()));
  83. p = HwdbpOpen (ansi);
  84. DEBUGMSG ((DBG_VERBOSE, "HwdbOpenW: leaving (p=%p, rc=%u)", p, GetLastError ()));
  85. // LeaveCriticalSection (&g_csHw);
  86. FreeString (ansi);
  87. return (HANDLE)p;
  88. }
  89. VOID
  90. WINAPI
  91. HwdbClose (
  92. IN HANDLE Hwdb
  93. )
  94. {
  95. // EnterCriticalSection (&g_csHw);
  96. DEBUGMSG ((DBG_VERBOSE, "HwdbClose(%p): entering (TID=%u)", Hwdb, GetCurrentThreadId ()));
  97. HwdbpClose ((PHWDB)Hwdb);
  98. DEBUGMSG ((DBG_VERBOSE, "HwdbClose: leaving (rc=%u)", GetLastError ()));
  99. // LeaveCriticalSection (&g_csHw);
  100. }
  101. BOOL
  102. WINAPI
  103. HwdbAppendInfsA (
  104. IN HANDLE Hwdb,
  105. IN PCSTR SourceDirectory,
  106. IN HWDBAPPENDINFSCALLBACKA Callback, OPTIONAL
  107. IN PVOID CallbackContext OPTIONAL
  108. )
  109. {
  110. BOOL b;
  111. // EnterCriticalSection (&g_csHw);
  112. DEBUGMSG ((
  113. DBG_VERBOSE,
  114. "HwdbAppendInfsA(%p,%s): entering (TID=%u)",
  115. Hwdb,
  116. SourceDirectory,
  117. GetCurrentThreadId ()
  118. ));
  119. b = HwdbpAppendInfs ((PHWDB)Hwdb, SourceDirectory, Callback, CallbackContext, FALSE);
  120. DEBUGMSG ((DBG_VERBOSE, "HwdbAppendInfsA: leaving (b=%u,rc=%u)", b, GetLastError ()));
  121. // LeaveCriticalSection (&g_csHw);
  122. return b;
  123. }
  124. BOOL
  125. WINAPI
  126. HwdbAppendInfsW (
  127. IN HANDLE Hwdb,
  128. IN PCWSTR SourceDirectory,
  129. IN HWDBAPPENDINFSCALLBACKW Callback, OPTIONAL
  130. IN PVOID CallbackContext OPTIONAL
  131. )
  132. {
  133. BOOL b;
  134. PCSTR ansi = ConvertToAnsiSz (SourceDirectory);
  135. // EnterCriticalSection (&g_csHw);
  136. DEBUGMSG ((
  137. DBG_VERBOSE,
  138. "HwdbAppendInfsW(%p,%s): entering (TID=%u)",
  139. Hwdb,
  140. SourceDirectory,
  141. GetCurrentThreadId ()
  142. ));
  143. b = HwdbpAppendInfs ((PHWDB)Hwdb, ansi, (HWDBAPPENDINFSCALLBACKA)Callback, CallbackContext, TRUE);
  144. DEBUGMSG ((DBG_VERBOSE, "HwdbAppendInfsW: leaving (b=%u,rc=%u)", b, GetLastError ()));
  145. // LeaveCriticalSection (&g_csHw);
  146. FreeString (ansi);
  147. return b;
  148. }
  149. BOOL
  150. WINAPI
  151. HwdbAppendDatabase (
  152. IN HANDLE HwdbTarget,
  153. IN HANDLE HwdbSource
  154. )
  155. {
  156. BOOL b;
  157. // EnterCriticalSection (&g_csHw);
  158. DEBUGMSG ((
  159. DBG_VERBOSE,
  160. "HwdbAppendDatabase(%p,%p): entering (TID=%u)",
  161. HwdbTarget,
  162. HwdbSource
  163. ));
  164. b = HwdbpAppendDatabase ((PHWDB)HwdbTarget, (PHWDB)HwdbSource);
  165. DEBUGMSG ((DBG_VERBOSE, "HwdbAppendDatabase: leaving (b=%u,rc=%u)", b, GetLastError ()));
  166. // LeaveCriticalSection (&g_csHw);
  167. return b;
  168. }
  169. BOOL
  170. WINAPI
  171. HwdbFlushA (
  172. IN HANDLE Hwdb,
  173. IN PCSTR OutputFile
  174. )
  175. {
  176. BOOL b;
  177. // EnterCriticalSection (&g_csHw);
  178. DEBUGMSG ((
  179. DBG_VERBOSE,
  180. "HwdbFlushA(%p,%s): entering (TID=%u)",
  181. Hwdb,
  182. OutputFile,
  183. GetCurrentThreadId ()
  184. ));
  185. b = HwdbpFlush ((PHWDB)Hwdb, OutputFile);
  186. DEBUGMSG ((DBG_VERBOSE, "HwdbFlushA: leaving (b=%u,rc=%u)", b, GetLastError ()));
  187. // LeaveCriticalSection (&g_csHw);
  188. return b;
  189. }
  190. BOOL
  191. WINAPI
  192. HwdbFlushW (
  193. IN HANDLE Hwdb,
  194. IN PCWSTR OutputFile
  195. )
  196. {
  197. BOOL b;
  198. PCSTR ansi = ConvertToAnsiSz (OutputFile);
  199. // EnterCriticalSection (&g_csHw);
  200. DEBUGMSG ((
  201. DBG_VERBOSE,
  202. "HwdbFlushW(%p,%s): entering (TID=%u)",
  203. Hwdb,
  204. OutputFile,
  205. GetCurrentThreadId ()
  206. ));
  207. b = HwdbpFlush ((PHWDB)Hwdb, ansi);
  208. DEBUGMSG ((DBG_VERBOSE, "HwdbFlushW: leaving (b=%u,rc=%u)", b, GetLastError ()));
  209. // LeaveCriticalSection (&g_csHw);
  210. FreeString (ansi);
  211. return b;
  212. }
  213. BOOL
  214. WINAPI
  215. HwdbHasDriverA (
  216. IN HANDLE Hwdb,
  217. IN PCSTR PnpId,
  218. OUT PBOOL Unsupported
  219. )
  220. {
  221. BOOL b;
  222. DEBUGMSG ((
  223. DBG_VERBOSE,
  224. "HwdbHasDriverA(%p,%s,%p): entering (TID=%u)",
  225. Hwdb,
  226. PnpId,
  227. Unsupported,
  228. GetCurrentThreadId ()
  229. ));
  230. // EnterCriticalSection (&g_csHw);
  231. b = HwdbpHasDriver ((PHWDB)Hwdb, PnpId, Unsupported);
  232. // LeaveCriticalSection (&g_csHw);
  233. DEBUGMSG ((DBG_VERBOSE, "HwdbHasDriverA: leaving (b=%u,rc=%u)", b, GetLastError ()));
  234. return b;
  235. }
  236. BOOL
  237. WINAPI
  238. HwdbHasDriverW (
  239. IN HANDLE Hwdb,
  240. IN PCWSTR PnpId,
  241. OUT PBOOL Unsupported
  242. )
  243. {
  244. BOOL b;
  245. PCSTR ansi = ConvertToAnsiSz (PnpId);
  246. DEBUGMSG ((
  247. DBG_VERBOSE,
  248. "HwdbHasDriverW(%p,%s,%p): entering (TID=%u)",
  249. Hwdb,
  250. PnpId,
  251. Unsupported,
  252. GetCurrentThreadId ()
  253. ));
  254. // EnterCriticalSection (&g_csHw);
  255. b = HwdbpHasDriver ((PHWDB)Hwdb, ansi, Unsupported);
  256. // LeaveCriticalSection (&g_csHw);
  257. DEBUGMSG ((DBG_VERBOSE, "HwdbHasDriverW: leaving (b=%u,rc=%u)", b, GetLastError ()));
  258. FreeString (ansi);
  259. return b;
  260. }
  261. BOOL
  262. WINAPI
  263. HwdbHasAnyDriverA (
  264. IN HANDLE Hwdb,
  265. IN PCSTR PnpIds,
  266. OUT PBOOL Unsupported
  267. )
  268. {
  269. BOOL b;
  270. DEBUGMSG ((
  271. DBG_VERBOSE,
  272. "HwdbHasAnyDriverA(%p,%s,%p): entering (TID=%u)",
  273. Hwdb,
  274. PnpIds,
  275. Unsupported,
  276. GetCurrentThreadId ()
  277. ));
  278. // EnterCriticalSection (&g_csHw);
  279. b = HwdbpHasAnyDriver ((PHWDB)Hwdb, PnpIds, Unsupported);
  280. // LeaveCriticalSection (&g_csHw);
  281. DEBUGMSG ((DBG_VERBOSE, "HwdbHasAnyDriverA: leaving (b=%u,rc=%u)", b, GetLastError ()));
  282. return b;
  283. }
  284. BOOL
  285. WINAPI
  286. HwdbHasAnyDriverW (
  287. IN HANDLE Hwdb,
  288. IN PCWSTR PnpIds,
  289. OUT PBOOL Unsupported
  290. )
  291. {
  292. BOOL b;
  293. PCSTR ansi = ConvertToAnsiMultiSz (PnpIds);
  294. DEBUGMSG ((
  295. DBG_VERBOSE,
  296. "HwdbHasAnyDriverW(%p,%s,%p): entering (TID=%u)",
  297. Hwdb,
  298. PnpIds,
  299. Unsupported,
  300. GetCurrentThreadId ()
  301. ));
  302. // EnterCriticalSection (&g_csHw);
  303. b = HwdbpHasAnyDriver ((PHWDB)Hwdb, ansi, Unsupported);
  304. // LeaveCriticalSection (&g_csHw);
  305. DEBUGMSG ((DBG_VERBOSE, "HwdbHasAnyDriverW: leaving (b=%u,rc=%u)", b, GetLastError ()));
  306. FreeString (ansi);
  307. return b;
  308. }
  309. #if 0
  310. BOOL
  311. HwdbEnumeratePnpIdA (
  312. IN HANDLE Hwdb,
  313. IN PHWDBENUM_CALLBACKA EnumCallback,
  314. IN PVOID UserContext
  315. )
  316. {
  317. BOOL b;
  318. DEBUGMSG ((
  319. DBG_VERBOSE,
  320. "HwdbEnumeratePnpIdA: entering (TID=%u)",
  321. GetCurrentThreadId ()
  322. ));
  323. // EnterCriticalSection (&g_csHw);
  324. b = HwdbpEnumeratePnpIdA ((PHWDB)Hwdb, EnumCallback, UserContext);
  325. // LeaveCriticalSection (&g_csHw);
  326. DEBUGMSG ((DBG_VERBOSE, "HwdbEnumeratePnpIdA: leaving (b=%u,rc=%u)", b, GetLastError ()));
  327. return b;
  328. }
  329. BOOL
  330. HwdbEnumeratePnpIdW (
  331. IN HANDLE Hwdb,
  332. IN PHWDBENUM_CALLBACKW EnumCallback,
  333. IN PVOID UserContext
  334. )
  335. {
  336. BOOL b;
  337. DEBUGMSG ((
  338. DBG_VERBOSE,
  339. "HwdbEnumeratePnpIdW: entering (TID=%u)",
  340. GetCurrentThreadId ()
  341. ));
  342. // EnterCriticalSection (&g_csHw);
  343. b = HwdbpEnumeratePnpIdW ((PHWDB)Hwdb, EnumCallback, UserContext);
  344. // LeaveCriticalSection (&g_csHw);
  345. DEBUGMSG ((DBG_VERBOSE, "HwdbEnumeratePnpIdW: leaving (b=%u,rc=%u)", b, GetLastError ()));
  346. return b;
  347. }
  348. #endif
  349. BOOL
  350. HwdbEnumFirstInfA (
  351. OUT PHWDBINF_ENUMA EnumPtr,
  352. IN PCSTR DatabaseFile
  353. )
  354. {
  355. BOOL b;
  356. b = HwdbpEnumFirstInfA (EnumPtr, DatabaseFile);
  357. return b;
  358. }
  359. BOOL
  360. HwdbEnumFirstInfW (
  361. OUT PHWDBINF_ENUMW EnumPtr,
  362. IN PCWSTR DatabaseFile
  363. )
  364. {
  365. BOOL b;
  366. PCSTR ansi = ConvertToAnsiSz (DatabaseFile);
  367. b = HwdbpEnumFirstInfW (EnumPtr, ansi);
  368. FreeString (ansi);
  369. return b;
  370. }
  371. BOOL
  372. HwdbEnumNextInfA (
  373. IN OUT PHWDBINF_ENUMA EnumPtr
  374. )
  375. {
  376. BOOL b;
  377. b = HwdbpEnumNextInfA (EnumPtr);
  378. return b;
  379. }
  380. BOOL
  381. HwdbEnumNextInfW (
  382. IN OUT PHWDBINF_ENUMW EnumPtr
  383. )
  384. {
  385. BOOL b;
  386. b = HwdbpEnumNextInfW (EnumPtr);
  387. return b;
  388. }
  389. VOID
  390. HwdbAbortEnumInfA (
  391. IN OUT PHWDBINF_ENUMA EnumPtr
  392. )
  393. {
  394. HwdbpAbortEnumInfA (EnumPtr);
  395. }
  396. VOID
  397. HwdbAbortEnumInfW (
  398. IN OUT PHWDBINF_ENUMW EnumPtr
  399. )
  400. {
  401. HwdbpAbortEnumInfW (EnumPtr);
  402. }