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.

534 lines
12 KiB

  1. #include "precomp.h"
  2. // CCifComponent_t
  3. CCifComponent_t::CCifComponent_t(ICifRWComponent * pCifRWComponentIn)
  4. {
  5. pCifRWComponent = pCifRWComponentIn;
  6. }
  7. STDMETHODIMP CCifComponent_t::GetID(LPTSTR pszID, DWORD cchSize)
  8. {
  9. CHAR szID[MAX_PATH];
  10. HRESULT hr;
  11. hr = pCifRWComponent->GetID(szID, countof(szID));
  12. A2Tbuf(szID, pszID, cchSize);
  13. return hr;
  14. }
  15. STDMETHODIMP CCifComponent_t::GetGUID(LPTSTR pszGUID, DWORD cchSize)
  16. {
  17. CHAR szGUID[MAX_PATH];
  18. HRESULT hr;
  19. hr = pCifRWComponent->GetGUID(szGUID, countof(szGUID));
  20. A2Tbuf(szGUID, pszGUID, cchSize);
  21. return hr;
  22. }
  23. STDMETHODIMP CCifComponent_t::GetDescription(LPTSTR pszDesc, DWORD cchSize)
  24. {
  25. CHAR szDesc[MAX_PATH];
  26. HRESULT hr;
  27. hr = pCifRWComponent->GetDescription(szDesc, countof(szDesc));
  28. A2Tbuf(szDesc, pszDesc, cchSize);
  29. return hr;
  30. }
  31. STDMETHODIMP CCifComponent_t::GetDetails(LPTSTR pszDetails, DWORD cchSize)
  32. {
  33. CHAR szDetails[MAX_PATH];
  34. HRESULT hr;
  35. hr = pCifRWComponent->GetDetails(szDetails, countof(szDetails));
  36. A2Tbuf(szDetails, pszDetails, cchSize);
  37. return hr;
  38. }
  39. STDMETHODIMP CCifComponent_t::GetUrl(UINT uUrlNum, LPTSTR pszUrl, DWORD cchSize, LPDWORD pdwUrlFlags)
  40. {
  41. CHAR szUrl[INTERNET_MAX_URL_LENGTH];
  42. HRESULT hr;
  43. hr = pCifRWComponent->GetUrl(uUrlNum, szUrl, countof(szUrl), pdwUrlFlags);
  44. A2Tbuf(szUrl, pszUrl, cchSize);
  45. return hr;
  46. }
  47. STDMETHODIMP CCifComponent_t::GetCommand(UINT uCmdNum, LPTSTR pszCmd, DWORD cchCmdSize, LPTSTR pszSwitches,
  48. DWORD cchSwitchSize, LPDWORD pdwType)
  49. {
  50. CHAR szCmd[MAX_PATH];
  51. CHAR szSwitches[MAX_PATH];
  52. HRESULT hr;
  53. hr = pCifRWComponent->GetCommand(uCmdNum, szCmd, countof(szCmd),
  54. szSwitches, countof(szSwitches), pdwType);
  55. A2Tbuf(szCmd, pszCmd, cchCmdSize);
  56. A2Tbuf(szSwitches, pszSwitches, cchSwitchSize);
  57. return hr;
  58. }
  59. STDMETHODIMP CCifComponent_t::GetVersion(LPDWORD pdwVersion, LPDWORD pdwBuild)
  60. {
  61. return pCifRWComponent->GetVersion(pdwVersion, pdwBuild);
  62. }
  63. STDMETHODIMP_(DWORD) CCifComponent_t::GetDownloadSize()
  64. {
  65. return pCifRWComponent->GetDownloadSize();
  66. }
  67. STDMETHODIMP CCifComponent_t::GetDependency(UINT uDepNum, LPTSTR pszID, DWORD cchSize, TCHAR *pchType,
  68. LPDWORD pdwVer, LPDWORD pdwBuild)
  69. {
  70. CHAR szID[MAX_PATH];
  71. CHAR chType;
  72. HRESULT hr;
  73. hr = pCifRWComponent->GetDependency(uDepNum, szID, countof(szID), &chType, pdwVer, pdwBuild);
  74. A2Tbuf(szID, pszID, cchSize);
  75. *pchType = (TCHAR)chType;
  76. return hr;
  77. }
  78. STDMETHODIMP_(DWORD) CCifComponent_t::GetPlatform()
  79. {
  80. return pCifRWComponent->GetPlatform();
  81. }
  82. STDMETHODIMP CCifComponent_t::GetMode(UINT uModeNum, LPTSTR pszModes, DWORD cchSize)
  83. {
  84. CHAR szModes[MAX_PATH];
  85. HRESULT hr;
  86. hr = pCifRWComponent->GetMode(uModeNum, szModes, countof(szModes));
  87. A2Tbuf(szModes, pszModes, cchSize);
  88. return hr;
  89. }
  90. STDMETHODIMP CCifComponent_t::GetGroup(LPTSTR pszID, DWORD cchSize)
  91. {
  92. CHAR szID[MAX_PATH];
  93. HRESULT hr;
  94. hr = pCifRWComponent->GetGroup(szID, countof(szID));
  95. A2Tbuf(szID, pszID, cchSize);
  96. return hr;
  97. }
  98. STDMETHODIMP CCifComponent_t::IsUIVisible()
  99. {
  100. return pCifRWComponent->IsUIVisible();
  101. }
  102. STDMETHODIMP CCifComponent_t::GetCustomData(LPTSTR pszKey, LPTSTR pszData, DWORD cchSize)
  103. {
  104. CHAR szData[MAX_PATH];
  105. HRESULT hr;
  106. USES_CONVERSION;
  107. hr = pCifRWComponent->GetCustomData(T2A(pszKey), szData, countof(szData));
  108. A2Tbuf(szData, pszData, cchSize);
  109. return hr;
  110. }
  111. // CCifRWComponent_t
  112. CCifRWComponent_t::CCifRWComponent_t(ICifRWComponent * pCifRWComponentIn) : CCifComponent_t(pCifRWComponentIn)
  113. {
  114. pCifRWComponent = pCifRWComponentIn;
  115. }
  116. STDMETHODIMP CCifRWComponent_t::SetGUID(LPCTSTR pszGUID)
  117. {
  118. USES_CONVERSION;
  119. return pCifRWComponent->SetGUID(T2CA(pszGUID));
  120. }
  121. STDMETHODIMP CCifRWComponent_t::SetDescription(LPCTSTR pszDesc)
  122. {
  123. USES_CONVERSION;
  124. return pCifRWComponent->SetDescription(T2CA(pszDesc));
  125. }
  126. STDMETHODIMP CCifRWComponent_t::SetCommand(UINT uCmdNum, LPCTSTR pszCmd, LPCTSTR pszSwitches, DWORD dwType)
  127. {
  128. USES_CONVERSION;
  129. return pCifRWComponent->SetCommand(uCmdNum, T2CA(pszCmd), T2CA(pszSwitches), dwType);
  130. }
  131. STDMETHODIMP CCifRWComponent_t::SetVersion(LPCTSTR pszVersion)
  132. {
  133. USES_CONVERSION;
  134. return pCifRWComponent->SetVersion(T2CA(pszVersion));
  135. }
  136. STDMETHODIMP CCifRWComponent_t::SetUninstallKey(LPCTSTR pszKey)
  137. {
  138. USES_CONVERSION;
  139. return pCifRWComponent->SetUninstallKey(T2CA(pszKey));
  140. }
  141. STDMETHODIMP CCifRWComponent_t::SetInstalledSize(DWORD dwWin, DWORD dwApp)
  142. {
  143. return pCifRWComponent->SetInstalledSize(dwWin, dwApp);
  144. }
  145. STDMETHODIMP CCifRWComponent_t::SetDownloadSize(DWORD dwSize)
  146. {
  147. return pCifRWComponent->SetDownloadSize(dwSize);
  148. }
  149. STDMETHODIMP CCifRWComponent_t::SetExtractSize(DWORD dwSize)
  150. {
  151. return pCifRWComponent->SetExtractSize(dwSize);
  152. }
  153. STDMETHODIMP CCifRWComponent_t::DeleteDependency(LPCTSTR pszID, TCHAR tchType)
  154. {
  155. USES_CONVERSION;
  156. return pCifRWComponent->DeleteDependency(T2CA(pszID), (CHAR)tchType);
  157. }
  158. STDMETHODIMP CCifRWComponent_t::AddDependency(LPCTSTR pszID, TCHAR tchType)
  159. {
  160. USES_CONVERSION;
  161. return pCifRWComponent->AddDependency(T2CA(pszID), (CHAR)tchType);
  162. }
  163. STDMETHODIMP CCifRWComponent_t::SetUIVisible(BOOL fVisible)
  164. {
  165. return pCifRWComponent->SetUIVisible(fVisible);
  166. }
  167. STDMETHODIMP CCifRWComponent_t::SetGroup(LPCTSTR pszID)
  168. {
  169. USES_CONVERSION;
  170. return pCifRWComponent->SetGroup(T2CA(pszID));
  171. }
  172. STDMETHODIMP CCifRWComponent_t::SetPlatform(DWORD dwPlatform)
  173. {
  174. return pCifRWComponent->SetPlatform(dwPlatform);
  175. }
  176. STDMETHODIMP CCifRWComponent_t::SetPriority(DWORD dwPriority)
  177. {
  178. return pCifRWComponent->SetPriority(dwPriority);
  179. }
  180. STDMETHODIMP CCifRWComponent_t::SetReboot(BOOL fReboot)
  181. {
  182. return pCifRWComponent->SetReboot(fReboot);
  183. }
  184. STDMETHODIMP CCifRWComponent_t::SetUrl(UINT uUrlNum, LPCTSTR pszUrl, DWORD dwUrlFlags)
  185. {
  186. USES_CONVERSION;
  187. return pCifRWComponent->SetUrl(uUrlNum, T2CA(pszUrl), dwUrlFlags);
  188. }
  189. STDMETHODIMP CCifRWComponent_t::DeleteFromModes(LPCTSTR pszMode)
  190. {
  191. USES_CONVERSION;
  192. return pCifRWComponent->DeleteFromModes(T2CA(pszMode));
  193. }
  194. STDMETHODIMP CCifRWComponent_t::AddToMode(LPCTSTR pszMode)
  195. {
  196. USES_CONVERSION;
  197. return pCifRWComponent->AddToMode(T2CA(pszMode));
  198. }
  199. STDMETHODIMP CCifRWComponent_t::SetModes(LPCTSTR pszMode)
  200. {
  201. USES_CONVERSION;
  202. return pCifRWComponent->SetModes(T2CA(pszMode));
  203. }
  204. STDMETHODIMP CCifRWComponent_t::CopyComponent(LPCTSTR pszCifFile)
  205. {
  206. USES_CONVERSION;
  207. return pCifRWComponent->CopyComponent(T2CA(pszCifFile));
  208. }
  209. STDMETHODIMP CCifRWComponent_t::AddToTreatAsOne(LPCTSTR pszCompID)
  210. {
  211. USES_CONVERSION;
  212. return pCifRWComponent->AddToTreatAsOne(T2CA(pszCompID));
  213. }
  214. STDMETHODIMP CCifRWComponent_t::SetDetails(LPCTSTR pszDesc)
  215. {
  216. USES_CONVERSION;
  217. return pCifRWComponent->SetDetails(T2CA(pszDesc));
  218. }
  219. // CCifRWGroup_t
  220. CCifRWGroup_t::CCifRWGroup_t(ICifRWGroup * pCifRWGroupIn)
  221. {
  222. pCifRWGroup = pCifRWGroupIn;
  223. }
  224. STDMETHODIMP CCifRWGroup_t::GetDescription(LPTSTR pszDesc, DWORD cchSize)
  225. {
  226. CHAR szDesc[MAX_PATH];
  227. HRESULT hr;
  228. USES_CONVERSION;
  229. hr = pCifRWGroup->GetDescription(szDesc, countof(szDesc));
  230. A2Tbuf(szDesc, pszDesc, cchSize);
  231. return hr;
  232. }
  233. STDMETHODIMP_(DWORD) CCifRWGroup_t::GetPriority()
  234. {
  235. return pCifRWGroup->GetPriority();
  236. }
  237. STDMETHODIMP CCifRWGroup_t::SetDescription(LPCTSTR pszDesc)
  238. {
  239. USES_CONVERSION;
  240. return pCifRWGroup->SetDescription(T2CA(pszDesc));
  241. }
  242. STDMETHODIMP CCifRWGroup_t::SetPriority(DWORD dwPriority)
  243. {
  244. return pCifRWGroup->SetPriority(dwPriority);
  245. }
  246. // CCifMode_t
  247. CCifMode_t::CCifMode_t(ICifRWMode * pCifRWModeIn)
  248. {
  249. pCifRWMode = pCifRWModeIn;
  250. }
  251. STDMETHODIMP CCifMode_t::GetID(LPTSTR pszID, DWORD cchSize)
  252. {
  253. CHAR szID[MAX_PATH];
  254. HRESULT hr;
  255. hr = pCifRWMode->GetID(szID, countof(szID));
  256. A2Tbuf(szID, pszID, cchSize);
  257. return hr;
  258. }
  259. STDMETHODIMP CCifMode_t::GetDescription(LPTSTR pszDesc, DWORD cchSize)
  260. {
  261. CHAR szDesc[MAX_PATH];
  262. HRESULT hr;
  263. hr = pCifRWMode->GetDescription(szDesc, countof(szDesc));
  264. A2Tbuf(szDesc, pszDesc, cchSize);
  265. return hr;
  266. }
  267. STDMETHODIMP CCifMode_t::GetDetails(LPTSTR pszDetails, DWORD cchSize)
  268. {
  269. CHAR szDetails[MAX_PATH];
  270. HRESULT hr;
  271. hr = pCifRWMode->GetDetails(szDetails, countof(szDetails));
  272. A2Tbuf(szDetails, pszDetails, cchSize);
  273. return hr;
  274. }
  275. // CCifRWMode_t
  276. CCifRWMode_t::CCifRWMode_t(ICifRWMode * pCifRWModeIn) : CCifMode_t(pCifRWModeIn)
  277. {
  278. pCifRWMode = pCifRWModeIn;
  279. }
  280. STDMETHODIMP CCifRWMode_t::SetDescription(LPCTSTR pszDesc)
  281. {
  282. USES_CONVERSION;
  283. return pCifRWMode->SetDescription(T2CA(pszDesc));
  284. }
  285. STDMETHODIMP CCifRWMode_t::SetDetails(LPCTSTR pszDetails)
  286. {
  287. USES_CONVERSION;
  288. return pCifRWMode->SetDetails(T2CA(pszDetails));
  289. }
  290. // CCifFile_t
  291. CCifFile_t::CCifFile_t(ICifRWFile * pCifRWFileIn)
  292. {
  293. pCifRWFile = pCifRWFileIn;
  294. }
  295. CCifFile_t::~CCifFile_t()
  296. {
  297. if (pCifRWFile != NULL)
  298. {
  299. pCifRWFile->Release();
  300. pCifRWFile = NULL;
  301. }
  302. }
  303. STDMETHODIMP CCifFile_t::EnumComponents(IEnumCifComponents ** ppEnumCifComponents,
  304. DWORD dwFilter, LPVOID pv)
  305. {
  306. return pCifRWFile->EnumComponents(ppEnumCifComponents, dwFilter, pv);
  307. }
  308. STDMETHODIMP CCifFile_t::FindComponent(LPCTSTR pszID, ICifComponent **p)
  309. {
  310. USES_CONVERSION;
  311. return pCifRWFile->FindComponent(T2CA(pszID), p);
  312. }
  313. STDMETHODIMP CCifFile_t::EnumModes(IEnumCifModes ** ppEnumCifModes, DWORD dwFilter, LPVOID pv)
  314. {
  315. return pCifRWFile->EnumModes(ppEnumCifModes, dwFilter, pv);
  316. }
  317. STDMETHODIMP CCifFile_t::FindMode(LPCTSTR pszID, ICifMode **p)
  318. {
  319. USES_CONVERSION;
  320. return pCifRWFile->FindMode(T2CA(pszID), p);
  321. }
  322. STDMETHODIMP CCifFile_t::GetDescription(LPTSTR pszDesc, DWORD cchSize)
  323. {
  324. CHAR szDesc[MAX_PATH];
  325. HRESULT hr;
  326. hr = pCifRWFile->GetDescription(szDesc, countof(szDesc));
  327. A2Tbuf(szDesc, pszDesc, cchSize);
  328. return hr;
  329. }
  330. // CCifRWFile_t
  331. CCifRWFile_t::CCifRWFile_t(ICifRWFile * pCifRWFileIn) : CCifFile_t(pCifRWFileIn)
  332. {
  333. pCifRWFile = pCifRWFileIn;
  334. }
  335. STDMETHODIMP CCifRWFile_t::SetDescription(LPCTSTR pszDesc)
  336. {
  337. USES_CONVERSION;
  338. return pCifRWFile->SetDescription(T2CA(pszDesc));
  339. }
  340. STDMETHODIMP CCifRWFile_t::CreateComponent(LPCTSTR pszID, ICifRWComponent **p)
  341. {
  342. USES_CONVERSION;
  343. return pCifRWFile->CreateComponent(T2CA(pszID), p);
  344. }
  345. STDMETHODIMP CCifRWFile_t::CreateGroup(LPCTSTR pszID, ICifRWGroup **p)
  346. {
  347. USES_CONVERSION;
  348. return pCifRWFile->CreateGroup(T2CA(pszID), p);
  349. }
  350. STDMETHODIMP CCifRWFile_t::CreateMode(LPCTSTR pszID, ICifRWMode **p)
  351. {
  352. USES_CONVERSION;
  353. return pCifRWFile->CreateMode(T2CA(pszID), p);
  354. }
  355. STDMETHODIMP CCifRWFile_t::DeleteComponent(LPCTSTR pszID)
  356. {
  357. USES_CONVERSION;
  358. return pCifRWFile->DeleteComponent(T2CA(pszID));
  359. }
  360. STDMETHODIMP CCifRWFile_t::DeleteGroup(LPCTSTR pszID)
  361. {
  362. USES_CONVERSION;
  363. return pCifRWFile->DeleteGroup(T2CA(pszID));
  364. }
  365. STDMETHODIMP CCifRWFile_t::DeleteMode(LPCTSTR pszID)
  366. {
  367. USES_CONVERSION;
  368. return pCifRWFile->DeleteMode(T2CA(pszID));
  369. }
  370. STDMETHODIMP CCifRWFile_t::Flush()
  371. {
  372. return pCifRWFile->Flush();
  373. }
  374. // cif functions
  375. HRESULT GetICifFileFromFile_t(CCifFile_t ** ppCifFile_t, LPCTSTR pszCifFile)
  376. {
  377. ICifFile * lpCifFile;
  378. HRESULT hr;
  379. USES_CONVERSION;
  380. if (SUCCEEDED(hr = GetICifFileFromFile(&lpCifFile, T2CA(pszCifFile))))
  381. *ppCifFile_t = new CCifFile_t((ICifRWFile *)lpCifFile);
  382. return hr;
  383. }
  384. HRESULT GetICifRWFileFromFile_t(CCifRWFile_t ** ppCifFile_t, LPCTSTR pszCifFile)
  385. {
  386. ICifRWFile * lpCifRWFile;
  387. HRESULT hr;
  388. USES_CONVERSION;
  389. if (SUCCEEDED(hr = GetICifRWFileFromFile(&lpCifRWFile, T2CA(pszCifFile))))
  390. *ppCifFile_t = new CCifRWFile_t(lpCifRWFile);
  391. return hr;
  392. }