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.

386 lines
6.7 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. All rights reserved.
  4. Module Name:
  5. local.h
  6. Abstract:
  7. Local header file for migration DLL of WIA class.
  8. Author:
  9. Keisuke Tsuchida (KeisukeT) 10-Oct-2000
  10. Revision History:
  11. --*/
  12. #ifndef LOCAL_H
  13. #define LOCAL_H
  14. //
  15. // Define
  16. //
  17. #define NAME_WIN9X_SETTING_FILE_A "sti9x.txt"
  18. #define NAME_WIN9X_SETTING_FILE_W L"sti9x.txt"
  19. #define NAME_MIGRATE_INF_A "migrate.inf"
  20. #define NAME_MIGRATE_INF_W L"migrate.inf"
  21. #define NAME_STILLIMAGE_A "StillImage"
  22. #define NAME_STILLIMAGE_W L"StillImage"
  23. #define NAME_FRIENDLYNAME_A "FriendlyName"
  24. #define NAME_FRIENDLYNAME_W L"FriendlyName"
  25. #define NAME_CREATEFILENAME_A "CreateFileName"
  26. #define NAME_CREATEFILENAME_W L"CreateFileName"
  27. #define NAME_INF_PATH_A "InfPath"
  28. #define NAME_INF_PATH_W L"InfPath"
  29. #define NAME_INF_SECTION_A "InfSection"
  30. #define NAME_INF_SECTION_W L"InfSection"
  31. #define NAME_INSTALLER_A "sti_ci.dll"
  32. #define NAME_INSTALLER_W L"sti_ci.dll"
  33. #define NAME_PROC_MIGRATEDEVICE_A "MigrateDevice"
  34. #define NAME_PROC_MIGRATEDEVICE_W L"MigrateDevice"
  35. #define NAME_DEVICE_A "Device"
  36. #define NAME_DEVICE_W L"Device"
  37. #define NAME_BEGIN_A "BEGIN"
  38. #define NAME_BEGIN_W L"BEGIN"
  39. #define NAME_END_A "END"
  40. #define NAME_END_W L"END"
  41. #define REGKEY_DEVICEDATA_A "DeviceData"
  42. #define REGKEY_DEVICEDATA_W L"DeviceData"
  43. #define REGVAL_SUBCLASS_A "SubClass"
  44. #define REGVAL_SUBCLASS_W L"SubClass"
  45. #define REGVAL_USDCLASS_A "USDClass"
  46. #define REGVAL_USDCLASS_W L"USDClass"
  47. #define REGVAL_NTMPDRIVER_A "NTMPDriver"
  48. #define REGVAL_NTMPDRIVER_W L"NTMPDriver"
  49. // Kodak related.
  50. #define FILEVER_KODAKIMAGING_WIN98_MS 0x4000a
  51. #define FILEVER_KODAKIMAGING_WIN98_LS 0x7ce
  52. #define PRODVER_KODAKIMAGING_WIN98_MS 0x10000
  53. #define PRODVER_KODAKIMAGING_WIN98_LS 0x51f
  54. #define FILEVER_KODAKIMAGING_WINME_MS 0x4005a
  55. #define FILEVER_KODAKIMAGING_WINME_LS 0xbb8
  56. #define PRODVER_KODAKIMAGING_WINME_MS 0x10000
  57. #define PRODVER_KODAKIMAGING_WINME_LS 0x520
  58. #define NAME_KODAKIMAGING_A "kodakimg.exe"
  59. #define NAME_KODAKIMAGING_W L"kodakimg.exe"
  60. #define REGSTR_PATH_KODAKEVENT_A "System\\CurrentControlSet\\Control\\StillImage\\Events\\STIProxyEvent\\{5F89FC93-A94E-4C0B-A1F2-DB6E97AA0B38}"
  61. #define REGSTR_PATH_KODAKEVENT_W L"System\\CurrentControlSet\\Control\\StillImage\\Events\\STIProxyEvent\\{5F89FC93-A94E-4C0B-A1F2-DB6E97AA0B38}"
  62. #define REGSTR_KEY_KODAKGUID_A "{5F89FC93-A94E-4C0B-A1F2-DB6E97AA0B38}"
  63. #define REGSTR_KEY_KODAKGUID_W L"{5F89FC93-A94E-4C0B-A1F2-DB6E97AA0B38}"
  64. #ifdef UNICODE
  65. #define NAME_KODAKIMAGING NAME_KODAKIMAGING_W
  66. #define REGSTR_PATH_KODAKEVENT REGSTR_PATH_KODAKEVENT_W
  67. #define REGSTR_KEY_KODAKGUID REGSTR_KEY_KODAKGUID_W
  68. #else // #ifdef UNICODE
  69. #define NAME_KODAKIMAGING NAME_KODAKIMAGING_A
  70. #define REGSTR_PATH_KODAKEVENT REGSTR_PATH_KODAKEVENT_A
  71. #define REGSTR_KEY_KODAKGUID REGSTR_KEY_KODAKGUID_A
  72. #endif // #ifdef UNICODE
  73. //
  74. // Typedef
  75. //
  76. typedef struct _PARAM_LIST {
  77. PVOID pNext;
  78. LPSTR pParam1;
  79. LPSTR pParam2;
  80. } PARAM_LIST, *PPARAM_LIST;
  81. typedef struct _DEVICE_INFO {
  82. LPSTR pszFriendlyName;
  83. LPSTR pszCreateFileName;
  84. LPSTR pszInfPath;
  85. LPSTR pszInfSection;
  86. DWORD dwNumberOfDeviceDataKey;
  87. PPARAM_LIST pDeviceDataParam;
  88. } DEVICE_INFO, *PDEVICE_INFO;
  89. //
  90. // Extern
  91. //
  92. extern HINSTANCE g_hInst;
  93. //
  94. // Proto-type
  95. //
  96. //
  97. // Migrate function
  98. //
  99. LONG
  100. CALLBACK
  101. Mig9xGetGlobalInfo(
  102. IN HANDLE hFile
  103. );
  104. LONG
  105. CALLBACK
  106. Mig9xGetDeviceInfo(
  107. IN HANDLE hFile
  108. );
  109. //
  110. // Debug functions
  111. //
  112. VOID
  113. DebugMsg(
  114. LPCSTR pszFormat,
  115. ...
  116. );
  117. //
  118. // Heap management
  119. //
  120. PVOID
  121. AllocMem(
  122. IN UINT cbSize
  123. );
  124. VOID
  125. FreeMem(
  126. IN PVOID pMem
  127. );
  128. LPSTR
  129. AllocStrA(
  130. IN LPCSTR pszStr
  131. );
  132. LPWSTR
  133. AllocStrW(
  134. IN LPCWSTR pszStr
  135. );
  136. LPWSTR
  137. AllocStrWFromStrA(
  138. LPCSTR pszStr
  139. );
  140. LPSTR
  141. AllocStrAFromStrW(
  142. LPCWSTR pszStr
  143. );
  144. VOID
  145. FreePrinterInfo2Strings(
  146. PPRINTER_INFO_2A pPrinterInfo2
  147. );
  148. //
  149. // Functions to write print config to the text file
  150. //
  151. BOOL
  152. WriteToFile(
  153. HANDLE hFile,
  154. LPCSTR pszFormat,
  155. ...
  156. );
  157. VOID
  158. WriteString(
  159. IN HANDLE hFile,
  160. IN OUT LPBOOL pbFail,
  161. IN LPCSTR pszStr
  162. );
  163. //
  164. // Functions to parse the text file having printing config info
  165. //
  166. LPSTR
  167. GetLine(
  168. IN HANDLE hFile,
  169. IN OUT LPBOOL pbFail
  170. );
  171. VOID
  172. ReadString(
  173. IN HANDLE hFile,
  174. OUT LPSTR *ppszParam1,
  175. OUT LPSTR *ppszParam2
  176. );
  177. VOID
  178. ReadDword(
  179. IN HANDLE hFile,
  180. IN LPSTR pszLine,
  181. IN DWORD dwLineSize,
  182. IN LPSTR pszPrefix,
  183. OUT LPDWORD pdwValue,
  184. IN OUT LPBOOL pbFail
  185. );
  186. //
  187. // Misc stuff
  188. //
  189. LPSTR
  190. ErrorMsg(
  191. VOID
  192. );
  193. VOID
  194. LogError(
  195. IN LogSeverity Severity,
  196. IN UINT MessageId,
  197. ...
  198. );
  199. LPSTR
  200. GetStringFromRcFileA(
  201. IN UINT uId
  202. );
  203. VOID
  204. SetupNetworkPrinterUpgrade(
  205. IN LPCSTR pszWorkingDir
  206. );
  207. BOOL
  208. ProcessNetPrnUpgradeForUser(
  209. HKEY hKeyUser
  210. );
  211. DWORD
  212. MySetDefaultPrinter(
  213. IN HKEY hUserRegKey,
  214. IN LPSTR pszDefaultPrinterString
  215. );
  216. VOID
  217. WriteRunOnceCount(
  218. );
  219. LPSTR
  220. GetDefPrnString(
  221. IN LPCSTR pszPrinterName
  222. );
  223. CHAR
  224. My_fgetc(
  225. HANDLE hFile
  226. );
  227. LPSTR
  228. My_fgets(
  229. LPSTR pszBuf,
  230. DWORD dwSize,
  231. HANDLE hFile
  232. );
  233. DWORD
  234. My_fread(
  235. LPBYTE pBuf,
  236. DWORD dwSize,
  237. HANDLE hFile
  238. );
  239. BOOL
  240. My_ungetc(
  241. HANDLE hFile
  242. );
  243. LONG
  244. WriteRegistryToFile(
  245. IN HANDLE hFile,
  246. IN HKEY hKey,
  247. IN LPCSTR pszPath
  248. );
  249. LONG
  250. WriteRegistryValueToFile(
  251. HANDLE hFile,
  252. LPSTR pszValue,
  253. DWORD dwType,
  254. PCHAR pDataBuffer,
  255. DWORD dwSize
  256. );
  257. LONG
  258. GetRegData(
  259. HKEY hKey,
  260. LPSTR pszValue,
  261. PCHAR *ppDataBuffer,
  262. PDWORD pdwType,
  263. PDWORD pdwSize
  264. );
  265. BOOL
  266. IsSti(
  267. HKEY hKeyDevice
  268. );
  269. BOOL
  270. IsKernelDriverRequired(
  271. HKEY hKeyDevice
  272. );
  273. LONG
  274. WriteDeviceToFile(
  275. HANDLE hFile,
  276. HKEY hKey
  277. );
  278. LONG
  279. MigNtProcessMigrationInfo(
  280. HANDLE hFile
  281. );
  282. LONG
  283. MigNtGetDevice(
  284. HANDLE hFile,
  285. PDEVICE_INFO pMigrateDevice
  286. );
  287. VOID
  288. MigNtFreeDeviceInfo(
  289. PDEVICE_INFO pMigrateDevice
  290. );
  291. VOID
  292. MyLogError(
  293. LPCSTR pszFormat,
  294. ...
  295. );
  296. BOOL
  297. MigNtIsWin9xImagingExisting(
  298. VOID
  299. );
  300. VOID
  301. MigNtRemoveKodakImagingKey(
  302. VOID
  303. );
  304. #endif // LOCAL_H