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.

196 lines
8.3 KiB

  1. #ifndef _HELPER_H_
  2. #define _HELPER_H_
  3. #include "wmrgexp.h"
  4. #include "ocmanage.h"
  5. #include "setupapi.h"
  6. #if DBG == 1
  7. #include <stdio.h>
  8. #include <stdarg.h>
  9. #define DECLARE_INFOLEVEL(comp) extern unsigned long comp##InfoLevel = DEF_INFOLEVEL;
  10. #define DECLARE_DEBUG(comp) \
  11. extern unsigned long comp##InfoLevel; \
  12. _inline void \
  13. comp##InlineDebugOut(unsigned long fDebugMask, TCHAR *pszfmt, ...) \
  14. { \
  15. if (comp##InfoLevel & fDebugMask) \
  16. { \
  17. TCHAR acsString[1000];\
  18. va_list va; \
  19. va_start(va, pszfmt);\
  20. _vstprintf(acsString, pszfmt, va); \
  21. va_end(va);\
  22. OutputDebugString(acsString);\
  23. } \
  24. }\
  25. _inline void \
  26. comp##InlineDebugOut( TCHAR *pszfmt, ...) \
  27. { \
  28. if ( TRUE ) \
  29. { \
  30. TCHAR acsString[1000];\
  31. va_list va; \
  32. va_start(va, pszfmt);\
  33. _vstprintf(acsString, pszfmt, va); \
  34. va_end(va);\
  35. OutputDebugString(acsString);\
  36. } \
  37. }
  38. #else // DBG == 0
  39. #define DECLARE_DEBUG(comp)
  40. #define DECLARE_INFOLEVEL(comp)
  41. #endif // DBG == 0
  42. DECLARE_DEBUG(iis);
  43. #define iisDebugOut(x) iisDebugOut2 x
  44. #define iisDebugOutSafeParams(x) iisDebugOutSafeParams2 x
  45. #define iisDebugOutSafe(x) iisDebugOutSafe2 x
  46. #define DO_IT_FOR_W3SVC_ANONYMOUSUSER 1
  47. #define DO_IT_FOR_MSFTPSVC_ANONYMOUSUSER 2
  48. #define DO_IT_FOR_W3SVC_WAMUSER 4
  49. // External globals from other .cpp files
  50. class MyLogFile;
  51. extern MyLogFile g_MyLogFile;
  52. class CInitApp;
  53. extern CInitApp* g_pTheApp;
  54. extern HANDLE g_MyModuleHandle;
  55. // structs
  56. typedef struct _CLUSTER_SVC_INFO_FILL_STRUCT
  57. {
  58. LPTSTR szTheClusterName;
  59. LPWSTR pszTheServiceType;
  60. CString * csTheReturnServiceResName;
  61. DWORD dwReturnStatus;
  62. } CLUSTER_SVC_INFO_FILL_STRUCT;
  63. typedef struct _ScriptMapNode {
  64. TCHAR szExt[32];
  65. TCHAR szProcessor[_MAX_PATH];
  66. DWORD dwFlags;
  67. TCHAR szMethods[_MAX_PATH];
  68. struct _ScriptMapNode *prev, *next;
  69. } ScriptMapNode;
  70. //
  71. // Functions
  72. //
  73. void iisDebugOut2(int iLogType, TCHAR *pszfmt, ...);
  74. void iisDebugOutSafeParams2(int iLogType, TCHAR *pszfmt, ...);
  75. void iisDebugOutSafe2(int iLogType, TCHAR *pszfmt);
  76. void iisDebugOut_Start(TCHAR *pszString, int iLogType = LOG_TYPE_TRACE_WIN32_API);
  77. void iisDebugOut_Start1(TCHAR *pszString1, TCHAR *pszString2, int iLogType = LOG_TYPE_TRACE_WIN32_API);
  78. void iisDebugOut_Start1(TCHAR *pszString1, CString pszString2, int iLogType = LOG_TYPE_TRACE_WIN32_API);
  79. void iisDebugOut_End(TCHAR *pszString, int iLogType = LOG_TYPE_TRACE_WIN32_API);
  80. void iisDebugOut_End1(TCHAR *pszString1, TCHAR *pszString2, int iLogType = LOG_TYPE_TRACE_WIN32_API);
  81. void iisDebugOut_End1(TCHAR *pszString1, CString pszString2, int iLogType = LOG_TYPE_TRACE_WIN32_API);
  82. void ProgressBarTextStack_Push(CString csText);
  83. void ProgressBarTextStack_Pop(void);
  84. void ProgressBarTextStack_Set(int iStringID);
  85. void ProgressBarTextStack_Set(int iStringID, const CString& csFileName);
  86. void ProgressBarTextStack_Set(int iStringID, const CString& csString1, const CString& csString2);
  87. void ProgressBarTextStack_Set(LPCTSTR szProgressTextString);
  88. void ProgressBarTextStack_Inst_Set( int ServiceNameID, int iInstanceNum);
  89. void ProgressBarTextStack_InstVRoot_Set( int ServiceNameID, int iInstanceNum, CString csVRName);
  90. void ProgressBarTextStack_InstInProc_Set( int ServiceNameID, int iInstanceNum, CString csVRName);
  91. void ListOfWarnings_Add(TCHAR * szEntry);
  92. void ListOfWarnings_Display(void);
  93. DWORD GetLastSectionToBeCalled(void);
  94. INT Register_iis_common();
  95. INT Unregister_iis_common();
  96. INT Unregister_old_asp();
  97. INT Register_iis_core();
  98. INT Unregister_iis_core();
  99. INT Register_iis_inetmgr();
  100. INT Unregister_iis_inetmgr();
  101. INT Register_iis_pwmgr();
  102. INT Unregister_iis_pwmgr();
  103. INT Register_iis_www();
  104. INT Unregister_iis_www();
  105. INT Register_iis_doc();
  106. INT Register_iis_htmla();
  107. INT Unregister_iis_htmla();
  108. INT Register_iis_ftp();
  109. INT Unregister_iis_ftp();
  110. LPWSTR MakeWideStrFromAnsi(LPSTR psz);
  111. int GetMultiStrSize(LPTSTR p);
  112. BOOL IsValidNumber(LPCTSTR szValue);
  113. int GetRandomNum(void);
  114. void SetRebootFlag(void);
  115. BOOL RunProgram( LPCTSTR pszProgram, LPTSTR CmdLine, BOOL fMinimized , DWORD dwWaitTimeInSeconds, BOOL fCreateNewConsole);
  116. void HandleSpecificErrors(DWORD iTheErrorCode, DWORD dwFormatReturn, CString csMsg, TCHAR pMsg[], CString *);
  117. BOOL GetDataFromMetabase(LPCTSTR szPath, int nID, LPBYTE Buffer, int BufSize);
  118. void AddOLEAUTRegKey();
  119. DWORD RegisterOLEControl(LPCTSTR lpszOcxFile, BOOL fAction);
  120. void lodctr(LPCTSTR lpszIniFile);
  121. void unlodctr(LPCTSTR lpszDriver);
  122. INT InstallPerformance(CString nlsRegPerf,CString nlsDll,CString nlsOpen,CString nlsClose,CString nlsCollect );
  123. INT AddEventLog(BOOL fSystem, CString nlsService, CString nlsMsgFile, DWORD dwType);
  124. INT RemoveEventLog(BOOL fSystem, CString nlsService );
  125. INT InstallAgent( CString nlsName, CString nlsPath );
  126. INT RemoveAgent( CString nlsServiceName );
  127. void InstallMimeMap();
  128. int CreateInProc(LPCTSTR lpszPath, int iUseOOPPool);
  129. void CreateInProc_Wrap(LPCTSTR lpszPath, int iUseOOPPool);
  130. void DeleteInProc(LPCTSTR lpszKeyPath);
  131. void SetAppFriendlyName(LPCTSTR szKeyPath);
  132. void SetInProc(LPCTSTR szKeyPath);
  133. void AddCustomError(IN DWORD dwCustErr, IN INT intSubCode, IN LPCTSTR szErrorString, IN LPCTSTR szKeyPath, IN BOOL fOverwriteExisting );
  134. ScriptMapNode *AllocNewScriptMapNode(LPTSTR szExt, LPTSTR szProcessor, DWORD dwFlags, LPTSTR szMethods);
  135. void InsertScriptMapList(ScriptMapNode *pList, ScriptMapNode *p, BOOL fReplace);
  136. void FreeScriptMapList(ScriptMapNode *pList);
  137. void GetScriptMapListFromRegistry(ScriptMapNode *pList);
  138. void GetScriptMapListFromMetabase(ScriptMapNode *pList, int iUpgradeType);
  139. void WriteScriptMapListToMetabase(ScriptMapNode *pList, LPTSTR szKeyPath, DWORD dwFlags);
  140. DWORD CallProcedureInDll_wrap(LPCTSTR lpszDLLFile, LPCTSTR lpszProcedureToCall, BOOL bDisplayMsgOnErrFlag, BOOL bInitOleFlag, BOOL iFunctionPrototypeFlag);
  141. DWORD CallProcedureInDll(LPCTSTR lpszDLLFile, LPCTSTR lpszProcedureToCall, BOOL bDisplayMsgOnErrFlag, BOOL bInitOleFlag, BOOL iFunctionPrototypeFlag);
  142. void GetDebugLevelFromInf(IN HINF hInfFileHandle);
  143. int IsThisStringInThisCStringList(CStringList &strList, LPCTSTR szStringToLookFor);
  144. int KillProcess_Wrap(LPCTSTR lpFullPathOrJustFileName);
  145. int ProcessSection(IN HINF hFile, IN LPCTSTR szTheSection);
  146. void uiCenterDialog( HWND hwndDlg );
  147. int AfterRemoveAll_SaveMetabase(void);
  148. int iOleInitialize(void);
  149. void iOleUnInitialize(int iBalanceOLE);
  150. BOOL SetupSetDirectoryId_Wrapper(HINF InfHandle,DWORD Id,LPCTSTR Directory);
  151. BOOL SetupSetStringId_Wrapper(HINF InfHandle,DWORD Id,LPCTSTR TheString);
  152. void LogImportantFiles(void);
  153. HRESULT FTestForOutstandingCoInits(void);
  154. void DisplayStringForMetabaseID(DWORD dwMetabaseID);
  155. void ReturnStringForMetabaseID(DWORD dwMetabaseID, LPTSTR lpReturnString);
  156. void SetErrorFlag(char *szFileName, int iLineNumber);
  157. DWORD FillStrListWithListOfSections(IN HINF hFile, CStringList &strList, IN LPCTSTR szSection);
  158. void MesssageBoxErrors_IIS(void);
  159. void MesssageBoxErrors_MTS(int iMtsThingWeWereDoing, DWORD dwErrorCode);
  160. void ShowIfModuleUsedForGroupOfSections(IN HINF hFile, int iUnlockThem);
  161. int ReadGlobalsFromInf(HINF InfHandle);
  162. int CheckIfPlatformMatchesInf(HINF InfHandle);
  163. int CheckSpecificBuildinInf(HINF InfHandle);
  164. int CheckForOldGopher(HINF InfHandle);
  165. void SetOCGlobalPrivateData(void);
  166. BOOL GetJavaTLD(LPTSTR lpszDir);
  167. void SetDIRIDforThisInf(HINF InfHandle);
  168. void ShowStateOfTheseServices(IN HINF hFile);
  169. int GetScriptMapAllInclusionVerbs(CString &csTheVerbList);
  170. void DumpScriptMapList();
  171. int GetSectionNameToDo(IN HINF hFile, CString & csTheSection);
  172. void CustomWWWRoot(LPCTSTR szWWWRoot);
  173. void CustomFTPRoot(LPCTSTR szFTPRoot);
  174. void AdvanceProgressBarTickGauge(int iTicks = 1);
  175. int IsMetabaseCorrupt(void);
  176. int ReadUserConfigurable(HINF InfHandle);
  177. int ReverseExpandEnvironmentStrings(LPTSTR szOriginalDir,LPTSTR szNewlyMungedDir);
  178. BOOL SetupFindFirstLine_Wrapped(IN HINF InfHandle,IN LPCTSTR Section,IN LPCTSTR Key,OPTIONAL INFCONTEXT *Context);
  179. INT IsThisOnNotStopList(IN HINF hFile, CString csInputName, BOOL bServiceFlag);
  180. HRESULT MofCompile(TCHAR * szPathMofFile);
  181. DWORD DoesEntryPointExist(LPCTSTR lpszDLLFile, LPCTSTR lpszProcedure);
  182. void CreateDummyMetabaseBin(void);
  183. BOOL RunningAsAdministrator();
  184. LPTSTR CreatePassword(int iSize);
  185. void CreatePasswordOld(TCHAR *pszPassword,int iSize);
  186. void StopAllServicesRegardless(int iShowErrorsFlag);
  187. #endif // _HELPER_H_