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.

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