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.

316 lines
17 KiB

  1. /*++ BUILD Version: 0001
  2. *
  3. * WOW v1.0
  4. *
  5. * Copyright (c) 2002, Microsoft Corporation
  6. *
  7. * dpmf_prf.h
  8. * WOW32 Dynamic Patch Module to support Profile API family
  9. * Definitions & macors to support calls into dpmfprf.dll
  10. *
  11. * History:
  12. * Created 01-10-2002 by cmjones
  13. --*/
  14. #ifndef _DPMF_PRFAPI_H_
  15. #define _DPMF_PRFAPI_H_
  16. #define PRFPFT (DPMFAMTBLS()[PRF_FAM])
  17. #define PRF_SHIM(ord, typ) ((typ)((pFT)->pDpmShmTbls[ord]))
  18. enum PrfFam {DPM_GETPRIVATEPROFILEINT=0, // Win 3.1 set
  19. DPM_GETPRIVATEPROFILESTRING,
  20. DPM_GETPROFILEINT,
  21. DPM_GETPROFILESTRING,
  22. DPM_WRITEPRIVATEPROFILESTRING,
  23. DPM_WRITEPROFILESTRING, // End Win 3.1 set
  24. DPM_WRITEPRIVATEPROFILESECTION,
  25. DPM_GETPRIVATEPROFILESECTION,
  26. DPM_GETPRIVATEPROFILESECTIONNAMES,
  27. DPM_GETPRIVATEPROFILESTRUCT,
  28. DPM_WRITEPRIVATEPROFILESTRUCT,
  29. DPM_WRITEPROFILESECTION,
  30. DPM_GETPROFILESECTION,
  31. DPM_GETPRIVATEPROFILEINTW, // WIDE CHAR versions for
  32. DPM_GETPRIVATEPROFILESTRINGW, // generic thunk support
  33. DPM_GETPROFILEINTW,
  34. DPM_GETPROFILESTRINGW,
  35. DPM_WRITEPRIVATEPROFILESTRINGW,
  36. DPM_WRITEPROFILESTRINGW,
  37. DPM_WRITEPRIVATEPROFILESECTIONW,
  38. DPM_GETPRIVATEPROFILESECTIONW,
  39. DPM_GETPRIVATEPROFILESECTIONNAMESW,
  40. DPM_GETPRIVATEPROFILESTRUCTW,
  41. DPM_WRITEPRIVATEPROFILESTRUCTW,
  42. DPM_WRITEPROFILESECTIONW,
  43. DPM_GETPROFILESECTIONW,
  44. enum_prf_last
  45. };
  46. // These types will catch misuse of parameters & ret types
  47. typedef ULONG (*typdpmGetPrivateProfileInt)(LPCSTR, LPCSTR, int, LPCSTR);
  48. typedef ULONG (*typdpmGetPrivateProfileString)(LPCSTR, LPCSTR, LPCSTR, LPSTR, int, LPCSTR);
  49. typedef ULONG (*typdpmWritePrivateProfileString)(LPCSTR, LPCSTR, LPCSTR, LPCSTR);
  50. typedef ULONG (*typdpmGetProfileInt)(LPCSTR, LPCSTR, int);
  51. typedef ULONG (*typdpmGetProfileString)(LPCSTR, LPCSTR, LPCSTR, LPSTR, int);
  52. typedef ULONG (*typdpmWriteProfileString)(LPCSTR, LPCSTR, LPCSTR);
  53. typedef ULONG (*typdpmWritePrivateProfileSection)(LPCSTR, LPCSTR, LPCSTR);
  54. typedef ULONG (*typdpmGetPrivateProfileSection)(LPCSTR, LPSTR, DWORD, LPCSTR);
  55. typedef ULONG (*typdpmGetPrivateProfileSectionNames)(LPSTR, DWORD, LPCSTR);
  56. typedef ULONG (*typdpmGetPrivateProfileStruct)(LPCSTR, LPCSTR, LPVOID, UINT, LPCSTR);
  57. typedef ULONG (*typdpmWritePrivateProfileStruct)(LPCSTR, LPCSTR, LPVOID, UINT, LPCSTR);
  58. typedef ULONG (*typdpmWriteProfileSection)(LPCSTR, LPCSTR);
  59. typedef ULONG (*typdpmGetProfileSection)(LPCSTR, LPSTR, DWORD);
  60. typedef ULONG (*typdpmGetPrivateProfileIntW)(LPCWSTR, LPCWSTR, int, LPCWSTR);
  61. typedef ULONG (*typdpmGetPrivateProfileStringW)(LPCWSTR, LPCWSTR, LPCWSTR, LPWSTR, int, LPCWSTR);
  62. typedef ULONG (*typdpmWritePrivateProfileStringW)(LPCWSTR, LPCWSTR, LPCWSTR, LPCWSTR);
  63. typedef ULONG (*typdpmGetProfileIntW)(LPCWSTR, LPCWSTR, int);
  64. typedef ULONG (*typdpmGetProfileStringW)(LPCWSTR, LPCWSTR, LPCWSTR, LPWSTR, int);
  65. typedef ULONG (*typdpmWriteProfileStringW)(LPCWSTR, LPCWSTR, LPCWSTR);
  66. typedef ULONG (*typdpmWritePrivateProfileSectionW)(LPCWSTR, LPCWSTR, LPCWSTR);
  67. typedef ULONG (*typdpmGetPrivateProfileSectionW)(LPCWSTR, LPWSTR, DWORD, LPCWSTR);
  68. typedef ULONG (*typdpmGetPrivateProfileSectionNamesW)(LPWSTR, DWORD, LPCWSTR);
  69. typedef ULONG (*typdpmGetPrivateProfileStructW)(LPCWSTR, LPCWSTR, LPVOID, UINT, LPCWSTR);
  70. typedef ULONG (*typdpmWritePrivateProfileStructW)(LPCWSTR, LPCWSTR, LPVOID, UINT, LPCWSTR);
  71. typedef ULONG (*typdpmWriteProfileSectionW)(LPCWSTR, LPCWSTR);
  72. typedef ULONG (*typdpmGetProfileSectionW)(LPCWSTR, LPWSTR, DWORD);
  73. // Macros to dispatch API calls properly
  74. #define DPM_GetPrivateProfileInt(a,b,c,d) \
  75. ((typdpmGetPrivateProfileInt)(PRFPFT->pfn[DPM_GETPRIVATEPROFILEINT]))(a,b,c,d)
  76. #define DPM_GetPrivateProfileString(a,b,c,d,e,f) \
  77. ((typdpmGetPrivateProfileString)(PRFPFT->pfn[DPM_GETPRIVATEPROFILESTRING]))(a,b,c,d,e,f)
  78. #define DPM_GetProfileInt(a,b,c) \
  79. ((typdpmGetProfileInt)(PRFPFT->pfn[DPM_GETPROFILEINT]))(a,b,c)
  80. #define DPM_GetProfileString(a,b,c,d,e) \
  81. ((typdpmGetProfileString)(PRFPFT->pfn[DPM_GETPROFILESTRING]))(a,b,c,d,e)
  82. #define DPM_WritePrivateProfileString(a,b,c,d) \
  83. ((typdpmWritePrivateProfileString)(PRFPFT->pfn[DPM_WRITEPRIVATEPROFILESTRING]))(a,b,c,d)
  84. #define DPM_WriteProfileString(a,b,c) \
  85. ((typdpmWriteProfileString)(PRFPFT->pfn[DPM_WRITEPROFILESTRING]))(a,b,c)
  86. #define DPM_WritePrivateProfileSection(a,b,c) \
  87. ((typdpmWritePrivateProfileSection)(PRFPFT->pfn[DPM_WRITEPRIVATEPROFILESECTION]))(a,b,c)
  88. #define DPM_GetPrivateProfileSection(a,b,c,d) \
  89. ((typdpmGetPrivateProfileSection)(PRFPFT->pfn[DPM_GETPRIVATEPROFILESECTION]))(a,b,c,d)
  90. #define DPM_GetPrivateProfileSectionNames(a,b,c) \
  91. ((typdpmGetPrivateProfileSectionNames)(PRFPFT->pfn[DPM_GETPRIVATEPROFILESECTIONNAMES]))(a,b,c)
  92. #define DPM_GetPrivateProfileStruct(a,b,c,d,e) \
  93. ((typdpmGetPrivateProfileStruct)(PRFPFT->pfn[DPM_GETPRIVATEPROFILESTRUCT]))(a,b,c,d,e)
  94. #define DPM_WritePrivateProfileStruct(a,b,c,d,e) \
  95. ((typdpmWritePrivateProfileStruct)(PRFPFT->pfn[DPM_WRITEPRIVATEPROFILESTRUCT]))(a,b,c,d,e)
  96. #define DPM_WriteProfileSection(a,b) \
  97. ((typdpmWriteProfileSection)(PRFPFT->pfn[DPM_WRITEPROFILESECTION]))(a,b)
  98. #define DPM_GetProfileSection(a,b,c) \
  99. ((typdpmGetProfileSection)(PRFPFT->pfn[DPM_GETPROFILESECTION]))(a,b,c)
  100. #define DPM_GetPrivateProfileIntW(a,b,c,d) \
  101. ((typdpmGetPrivateProfileIntW)(PRFPFT->pfn[DPM_GETPRIVATEPROFILEINTW]))(a,b,c,d)
  102. #define DPM_GetPrivateProfileStringW(a,b,c,d,e,f) \
  103. ((typdpmGetPrivateProfileStringW)(PRFPFT->pfn[DPM_GETPRIVATEPROFILESTRINGW]))(a,b,c,d,e,f)
  104. #define DPM_GetProfileIntW(a,b,c) \
  105. ((typdpmGetProfileIntW)(PRFPFT->pfn[DPM_GETPROFILEINTW]))(a,b,c)
  106. #define DPM_GetProfileStringW(a,b,c,d,e) \
  107. ((typdpmGetProfileStringW)(PRFPFT->pfn[DPM_GETPROFILESTRINGW]))(a,b,c,d,e)
  108. #define DPM_WritePrivateProfileStringW(a,b,c,d) \
  109. ((typdpmWritePrivateProfileStringW)(PRFPFT->pfn[DPM_WRITEPRIVATEPROFILESTRINGW]))(a,b,c,d)
  110. #define DPM_WriteProfileStringW(a,b,c) \
  111. ((typdpmWriteProfileStringW)(PRFPFT->pfn[DPM_WRITEPROFILESTRINGW]))(a,b,c)
  112. #define DPM_WritePrivateProfileSectionW(a,b,c) \
  113. ((typdpmWritePrivateProfileSectionW)(PRFPFT->pfn[DPM_WRITEPRIVATEPROFILESECTIONW]))(a,b,c)
  114. #define DPM_GetPrivateProfileSectionW(a,b,c,d) \
  115. ((typdpmGetPrivateProfileSectionW)(PRFPFT->pfn[DPM_GETPRIVATEPROFILESECTIONW]))(a,b,c,d)
  116. #define DPM_GetPrivateProfileSectionNamesW(a,b,c) \
  117. ((typdpmGetPrivateProfileSectionNamesW)(PRFPFT->pfn[DPM_GETPRIVATEPROFILESECTIONNAMESW]))(a,b,c)
  118. #define DPM_GetPrivateProfileStructW(a,b,c,d,e) \
  119. ((typdpmGetPrivateProfileStructW)(PRFPFT->pfn[DPM_GETPRIVATEPROFILESTRUCTW]))(a,b,c,d,e)
  120. #define DPM_WritePrivateProfileStructW(a,b,c,d,e) \
  121. ((typdpmWritePrivateProfileStructW)(PRFPFT->pfn[DPM_WRITEPRIVATEPROFILESTRUCTW]))(a,b,c,d,e)
  122. #define DPM_WriteProfileSectionW(a,b) \
  123. ((typdpmWriteProfileSectionW)(PRFPFT->pfn[DPM_WRITEPROFILESECTIONW]))(a,b)
  124. #define DPM_GetProfileSectionW(a,b,c) \
  125. ((typdpmGetProfileSectionW)(PRFPFT->pfn[DPM_GETPROFILESECTIONW]))(a,b,c)
  126. // Macros to dispatch Shimed API calls properly from the dpmfxxx.dll
  127. #define SHM_GetPrivateProfileInt(a,b,c,d) \
  128. (PRF_SHIM(DPM_GETPRIVATEPROFILEINT, \
  129. typdpmGetPrivateProfileInt))(a,b,c,d)
  130. #define SHM_GetPrivateProfileString(a,b,c,d,e,f) \
  131. (PRF_SHIM(DPM_GETPRIVATEPROFILESTRING, \
  132. typdpmGetPrivateProfileString))(a,b,c,d,e,f)
  133. #define SHM_GetProfileInt(a,b,c) \
  134. (PRF_SHIM(DPM_GETPROFILEINT, \
  135. typdpmGetProfileInt))(a,b,c)
  136. #define SHM_GetProfileString(a,b,c,d,e) \
  137. (PRF_SHIM(DPM_GETPROFILESTRING, \
  138. typdpmGetProfileString))(a,b,c,d,e)
  139. #define SHM_WritePrivateProfileString(a,b,c,d) \
  140. (PRF_SHIM(DPM_WRITEPRIVATEPROFILESTRING, \
  141. typdpmWritePrivateProfileString))(a,b,c,d)
  142. #define SHM_WriteProfileString(a,b,c) \
  143. (PRF_SHIM(DPM_WRITEPROFILESTRING, \
  144. typdpmWriteProfileString))(a,b,c)
  145. #define SHM_WritePrivateProfileSection(a,b,c) \
  146. (PRF_SHIM(DPM_WRITEPRIVATEPROFILESECTION, \
  147. typdpmWritePrivateProfileSection))(a,b,c)
  148. #define SHM_GetPrivateProfileSection(a,b,c,d) \
  149. (PRF_SHIM(DPM_GETPRIVATEPROFILESECTION, \
  150. typdpmGetPrivateProfileSection))(a,b,c,d)
  151. #define SHM_GetPrivateProfileSectionNames(a,b,c) \
  152. (PRF_SHIM(DPM_GETPRIVATEPROFILESECTIONNAMES, \
  153. typdpmGetPrivateProfileSectionNames))(a,b,c)
  154. #define SHM_GetPrivateProfileStruct(a,b,c,d,e) \
  155. (PRF_SHIM(DPM_GETPRIVATEPROFILESTRUCT, \
  156. typdpmGetPrivateProfileStruct))(a,b,c,d,e)
  157. #define SHM_WritePrivateProfileStruct(a,b,c,d,e) \
  158. (PRF_SHIM(DPM_WRITEPRIVATEPROFILESTRUCT, \
  159. typdpmWritePrivateProfileStruct))(a,b,c,d,e)
  160. #define SHM_WriteProfileSection(a,b) \
  161. (PRF_SHIM(DPM_WRITEPROFILESECTION, \
  162. typdpmWriteProfileSection))(a,b)
  163. #define SHM_GetProfileSection(a,b,c) \
  164. (PRF_SHIM(DPM_GETPROFILESECTION, \
  165. typdpmGetProfileSection))(a,b,c)
  166. #define SHM_GetPrivateProfileIntW(a,b,c,d) \
  167. (PRF_SHIM(DPM_GETPRIVATEPROFILEINTW, \
  168. typdpmGetPrivateProfileIntW))(a,b,c,d)
  169. #define SHM_GetPrivateProfileStringW(a,b,c,d,e,f) \
  170. (PRF_SHIM(DPM_GETPRIVATEPROFILESTRINGW, \
  171. typdpmGetPrivateProfileStringW))(a,b,c,d,e,f)
  172. #define SHM_GetProfileIntW(a,b,c) \
  173. (PRF_SHIM(DPM_GETPROFILEINTW, \
  174. typdpmGetProfileIntW))(a,b,c)
  175. #define SHM_GetProfileStringW(a,b,c,d,e) \
  176. (PRF_SHIM(DPM_GETPROFILESTRINGW, \
  177. typdpmGetProfileStringW))(a,b,c,d,e)
  178. #define SHM_WritePrivateProfileStringW(a,b,c,d) \
  179. (PRF_SHIM(DPM_WRITEPRIVATEPROFILESTRINGW, \
  180. typdpmWritePrivateProfileStringW))(a,b,c,d)
  181. #define SHM_WriteProfileStringW(a,b,c) \
  182. (PRF_SHIM(DPM_WRITEPROFILESTRINGW, \
  183. typdpmWriteProfileStringW))(a,b,c)
  184. #define SHM_WritePrivateProfileSectionW(a,b,c) \
  185. (PRF_SHIM(DPM_WRITEPRIVATEPROFILESECTIONW, \
  186. typdpmWritePrivateProfileSectionW))(a,b,c)
  187. #define SHM_GetPrivateProfileSectionW(a,b,c,d) \
  188. (PRF_SHIM(DPM_GETPRIVATEPROFILESECTIONW, \
  189. typdpmGetPrivateProfileSectionW))(a,b,c,d)
  190. #define SHM_GetPrivateProfileSectionNamesW(a,b,c) \
  191. (PRF_SHIM(DPM_GETPRIVATEPROFILESECTIONNAMESW, \
  192. typdpmGetPrivateProfileSectionNamesW))(a,b,c)
  193. #define SHM_GetPrivateProfileStructW(a,b,c,d,e) \
  194. (PRF_SHIM(DPM_GETPRIVATEPROFILESTRUCTW, \
  195. typdpmGetPrivateProfileStructW))(a,b,c,d,e)
  196. #define SHM_WritePrivateProfileStructW(a,b,c,d,e) \
  197. (PRF_SHIM(DPM_WRITEPRIVATEPROFILESTRUCTW, \
  198. typdpmWritePrivateProfileStructW))(a,b,c,d,e)
  199. #define SHM_WriteProfileSectionW(a,b) \
  200. (PRF_SHIM(DPM_WRITEPROFILESECTIONW, \
  201. typdpmWriteProfileSectionW))(a,b)
  202. #define SHM_GetProfileSectionW(a,b,c) \
  203. (PRF_SHIM(DPM_GETPROFILESECTIONW, \
  204. typdpmGetProfileSectionW))(a,b,c)
  205. #endif // _DPMF_PRFAPI_H_
  206. // These need to be in the same order as the PrfFam enum definitions above and
  207. // the DpmPrfTbl[] list below.// This instantiates memory for DpmPrfStrs in mvdm\wow32\wdpm.c
  208. #ifdef _WDPM_C_
  209. const char *DpmPrfStrs[] = {"GetPrivateProfileIntA", "GetPrivateProfileStringA",
  210. "GetProfileIntA",
  211. "GetProfileStringA",
  212. "WritePrivateProfileStringA",
  213. "WriteProfileStringA",
  214. "WritePrivateProfileSectionA",
  215. "GetPrivateProfileSectionA",
  216. "GetPrivateProfileSectionNamesA",
  217. "GetPrivateProfileStructA",
  218. "WritePrivateProfileStructA",
  219. "WriteProfileSectionA",
  220. "GetProfileSectionA",
  221. "GetPrivateProfileIntW",
  222. "GetPrivateProfileStringW",
  223. "GetProfileIntW",
  224. "GetProfileStringW",
  225. "WritePrivateProfileStringW",
  226. "WriteProfileStringW",
  227. "WritePrivateProfileSectionW",
  228. "GetPrivateProfileSectionW",
  229. "GetPrivateProfileSectionNamesW",
  230. "GetPrivateProfileStructW",
  231. "WritePrivateProfileStructW",
  232. "WriteProfileSectionW",
  233. "GetProfileSectionW"
  234. };
  235. // These need to be in the same order as the PrfFam enum definitions and the
  236. // the DpmPrfStrs[] list above.// This instantiates memory for DpmPrfTbl[] in mvdm\wow32\wdpm.c
  237. PVOID DpmPrfTbl[] = {GetPrivateProfileIntA, GetPrivateProfileStringA,
  238. GetProfileIntA,
  239. GetProfileStringA,
  240. WritePrivateProfileStringA,
  241. WriteProfileStringA,
  242. WritePrivateProfileSectionA,
  243. GetPrivateProfileSectionA,
  244. GetPrivateProfileSectionNamesA,
  245. GetPrivateProfileStructA,
  246. WritePrivateProfileStructA,
  247. WriteProfileSectionA,
  248. GetProfileSectionA,
  249. GetPrivateProfileIntW,
  250. GetPrivateProfileStringW,
  251. GetProfileIntW,
  252. GetProfileStringW,
  253. WritePrivateProfileStringW,
  254. WriteProfileStringW,
  255. WritePrivateProfileSectionW,
  256. GetPrivateProfileSectionW,
  257. GetPrivateProfileSectionNamesW,
  258. GetPrivateProfileStructW,
  259. WritePrivateProfileStructW,
  260. WriteProfileSectionW,
  261. GetProfileSectionW
  262. };
  263. #define NUM_HOOKED_PRF_APIS ((sizeof DpmPrfTbl)/(sizeof DpmPrfTbl[0]))
  264. // This instantiates memory for DpmPrfFam in mvdm\wow32\wdpm.c
  265. FAMILY_TABLE DpmPrfFam = {NUM_HOOKED_PRF_APIS, 0, 0, 0, 0, DpmPrfTbl};
  266. #endif // _WDPM_C_