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.

293 lines
8.9 KiB

  1. /*****************************************************************/
  2. /** Microsoft Windows for Workgroups **/
  3. /** Copyright (c) 1991-1998 Microsoft Corporation
  4. /*****************************************************************/
  5. //
  6. // CFGDLL.C - 32-bit stubs for functions that call into 16-bit DLL
  7. //
  8. // HISTORY:
  9. //
  10. // 96/05/22 markdu Created (from inetcfg.dll)
  11. // 96/05/27 markdu Initialize and destroy gpszLastErrorText.
  12. //
  13. #include "pch.hpp"
  14. // instance handle must be in per-instance data segment
  15. #pragma data_seg(DATASEG_PERINSTANCE)
  16. HINSTANCE ghInstance=NULL;
  17. LPSTR gpszLastErrorText=NULL;
  18. #pragma data_seg(DATASEG_DEFAULT)
  19. typedef UINT RETERR;
  20. // prototypes for functions we thunk to
  21. #ifdef __cplusplus
  22. extern "C"
  23. {
  24. #endif // __cplusplus
  25. extern RETERR __stdcall GetClientConfig16(LPCLIENTCONFIG pClientConfig);
  26. extern UINT __stdcall InstallComponent16(HWND hwndParent,DWORD dwComponent,DWORD dwParam);
  27. extern RETERR __stdcall BeginNetcardTCPIPEnum16(VOID);
  28. extern BOOL __stdcall GetNextNetcardTCPIPNode16(LPSTR pszTcpNode,WORD cbTcpNode,
  29. DWORD dwFlags);
  30. extern VOID __stdcall GetSETUPXErrorText16(DWORD dwErr,LPSTR pszErrorDesc,DWORD cbErrorDesc);
  31. extern RETERR __stdcall RemoveProtocols16(HWND hwndParent,DWORD dwRemoveFromCardType,DWORD dwProtocols);
  32. extern RETERR __stdcall RemoveUnneededDefaultComponents16(HWND hwndParent);
  33. extern RETERR __stdcall DoGenInstall16(HWND hwndParent,LPCSTR lpszInfFile,LPCSTR lpszInfSect);
  34. extern RETERR __stdcall SetInstallSourcePath16(LPCSTR szSourcePath);
  35. BOOL WINAPI wizthk_ThunkConnect32(LPSTR pszDll16,LPSTR pszDll32,HINSTANCE hInst,
  36. DWORD dwReason);
  37. BOOL _stdcall DllEntryPoint(HINSTANCE hInstDll, DWORD fdwReason, LPVOID lpReserved);
  38. #ifdef __cplusplus
  39. }
  40. #endif // __cplusplus
  41. #if defined(CMBUILD)
  42. static const CHAR szDll16[] = "CNET16.DLL";
  43. static const CHAR szDll32[] = "CCFG32.DLL";
  44. #else
  45. static const CHAR szDll16[] = "INET16.DLL";
  46. static const CHAR szDll32[] = "ICFG32.DLL";
  47. #endif
  48. /*******************************************************************
  49. NAME: DllEntryPoint
  50. SYNOPSIS: Entry point for DLL.
  51. NOTES: Initializes thunk layer to inet16.DLL
  52. ********************************************************************/
  53. BOOL _stdcall DllEntryPoint(HINSTANCE hInstDll, DWORD fdwReason, LPVOID lpReserved)
  54. {
  55. // initialize thunk layer to inet16.dll
  56. if (!(wizthk_ThunkConnect32((LPSTR)szDll16,(LPSTR)szDll32,hInstDll,
  57. fdwReason)))
  58. return FALSE;
  59. if( fdwReason == DLL_PROCESS_ATTACH )
  60. {
  61. ghInstance = hInstDll;
  62. // Allocate memory for the error message text for GetLastInstallErrorText()
  63. gpszLastErrorText = (LPSTR)LocalAlloc(LPTR, MAX_ERROR_TEXT);
  64. if (NULL == gpszLastErrorText)
  65. {
  66. return FALSE;
  67. }
  68. }
  69. if( fdwReason == DLL_PROCESS_DETACH )
  70. {
  71. LocalFree(gpszLastErrorText);
  72. }
  73. return TRUE;
  74. }
  75. /*******************************************************************
  76. NAME: GetClientConfig
  77. SYNOPSIS: Retrieves client software configration
  78. ENTRY: pClientConfig - pointer to struct to fill in with config info
  79. EXIT: returns a SETUPX error code
  80. NOTES: This is just the 32-bit side wrapper, thunks to GetClientConfig16
  81. to do real work. Information needs to be obtained from
  82. setupx.dll, which is 16-bit.
  83. ********************************************************************/
  84. RETERR GetClientConfig(CLIENTCONFIG * pClientConfig)
  85. {
  86. ASSERT(pClientConfig);
  87. // thunk to GetClientConfig16 to do real work
  88. return GetClientConfig16(pClientConfig);
  89. }
  90. /*******************************************************************
  91. NAME: InstallComponent
  92. SYNOPSIS: Installs the specified component
  93. ENTRY: dwComponent - ordinal of component to install
  94. (IC_xxx, defined in wizglob.h)
  95. dwParam - component-specific parameters, defined in wizglob.h
  96. EXIT: returns ERROR_SUCCESS if successful, or a standard error code
  97. NOTES: This is just the 32-bit side wrapper, thunks to InstallComponent16
  98. to do real work.
  99. ********************************************************************/
  100. UINT InstallComponent(HWND hwndParent,DWORD dwComponent,DWORD dwParam)
  101. {
  102. // thunk to InstallComponent16 to do real work
  103. return InstallComponent16(hwndParent,dwComponent,dwParam);
  104. }
  105. /*******************************************************************
  106. NAME: BeginNetcardTCPIPEnum16Enum
  107. SYNOPSIS: Begins an enumeration of netcard TCP/IP nodes
  108. NOTES: Subsequent calls to GetNextNetcardTCPIPNode16 will
  109. enumerate TCP/IP nodes
  110. This is just the 32-bit side wrapper, thunks to 16-bit
  111. side to do real work.
  112. ********************************************************************/
  113. RETERR BeginNetcardTCPIPEnum(VOID)
  114. {
  115. return BeginNetcardTCPIPEnum16();
  116. }
  117. /*******************************************************************
  118. NAME: GetNextNetcardTCPIPNode16
  119. SYNOPSIS: Enumerates the next TCP/IP node of specified type
  120. ENTRY: pszTcpNode - pointer to buffer to be filled in with
  121. node subkey name
  122. cbTcpNode - size of pszTcpNode buffer
  123. dwFlags - some combination of INSTANCE_ flags
  124. indicating what kind of instance to enumerate
  125. EXIT: returns TRUE if a TCPIP node was enumerated,
  126. FALSE if no more nodes to enumerate
  127. NOTES: BeginNetcardTCPIPEnum16 must be called before each
  128. enumeration to start at the beginning of the list.
  129. This is just the 32-bit side wrapper, thunks to 16-bit
  130. side to do real work.
  131. ********************************************************************/
  132. BOOL GetNextNetcardTCPIPNode(LPSTR pszTcpNode,WORD cbTcpNode, DWORD dwFlags)
  133. {
  134. return GetNextNetcardTCPIPNode16(pszTcpNode,cbTcpNode,dwFlags);
  135. }
  136. /*******************************************************************
  137. NAME: GetSETUPXErrorText
  138. SYNOPSIS: Gets text corresponding to SETUPX error code
  139. ENTRY: dwErr - error to get text for
  140. pszErrorDesc - pointer to buffer to fill in with text
  141. cbErrorDesc - size of pszErrorDesc buffer
  142. NOTES: This is just the 32-bit side wrapper, thunks to 16-bit
  143. side to do real work.
  144. ********************************************************************/
  145. extern "C" VOID GetSETUPXErrorText(DWORD dwErr,LPSTR pszErrorDesc,DWORD cbErrorDesc)
  146. {
  147. GetSETUPXErrorText16(dwErr,pszErrorDesc,cbErrorDesc);
  148. }
  149. /*******************************************************************
  150. NAME: RemoveUnneededDefaultComponents
  151. SYNOPSIS: Removes network components that we don't need which
  152. are installed by default when an adapter is added
  153. to a no-net system.
  154. NOTES: Removes: vredir, nwredir, netbeui, ipx
  155. This is just the 32-bit side wrapper, thunks to 16-bit
  156. side to do real work.
  157. ********************************************************************/
  158. RETERR RemoveUnneededDefaultComponents(HWND hwndParent)
  159. {
  160. return RemoveUnneededDefaultComponents16(hwndParent);
  161. }
  162. /*******************************************************************
  163. NAME: RemoveProtocols
  164. SYNOPSIS: Removes specified protocols from card of specified type
  165. NOTES: This function is useful because if user has a net card
  166. and we add PPPMAC, all the protocols that were bound
  167. to the net card appear on PPPMAC. We need to go through
  168. and strip them off.
  169. This is just the 32-bit side wrapper, thunks to 16-bit
  170. side to do real work.
  171. ********************************************************************/
  172. RETERR RemoveProtocols(HWND hwndParent,DWORD dwRemoveFromCardType,DWORD dwProtocols)
  173. {
  174. return RemoveProtocols16(hwndParent,dwRemoveFromCardType,dwProtocols);
  175. }
  176. /*******************************************************************
  177. NAME: DoGenInstall
  178. SYNOPSIS: Calls GenInstall to do file copies, registry entries,
  179. etc. in specified .inf file and section.
  180. ENTRY: hwndParent - parent window
  181. lpszInfFile - name of .inf file.
  182. lpszInfSect - name of section in .inf file.
  183. EXIT: returns OK, or a SETUPX error code.
  184. This is just the 32-bit side wrapper, thunks to 16-bit
  185. side to do real work.
  186. ********************************************************************/
  187. RETERR DoGenInstall(HWND hwndParent,LPCSTR lpszInfFile,LPCSTR lpszInfSect)
  188. {
  189. return DoGenInstall16(hwndParent,lpszInfFile,lpszInfSect);
  190. }
  191. //*******************************************************************
  192. //
  193. // FUNCTION: IcfgSetInstallSourcePath
  194. //
  195. // PURPOSE: Sets the path where windows looks when installing files.
  196. //
  197. // PARAMETERS: lpszSourcePath - full path of location of files to install.
  198. // If this is NULL, default path is used.
  199. //
  200. // RETURNS: HRESULT code, ERROR_SUCCESS if no errors occurred
  201. //
  202. //*******************************************************************
  203. extern "C" HRESULT IcfgSetInstallSourcePath(LPCSTR lpszSourcePath)
  204. {
  205. // thunk to InstallComponent16 to do real work
  206. return SetInstallSourcePath16(lpszSourcePath);
  207. }