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.

208 lines
6.1 KiB

  1. #ifndef __RW_COMMON__
  2. #define __RW_COMMON__
  3. #include <windows.h>
  4. #include <stdio.h>
  5. //#include <iostream.h>
  6. //#include <fstream.h>
  7. #include <tchar.h>
  8. #include <wininet.h>
  9. #ifdef __cplusplus
  10. extern "C"
  11. {
  12. #endif
  13. int InvokeRegistration ( HINSTANCE hInstance , LPCTSTR czPath);
  14. void TransmitRegWizInfo ( HINSTANCE hInstance , LPCTSTR szParams,BOOL fOEM);
  15. void DisplayInterNetConnectingMsg(HINSTANCE hIns);
  16. void CloseDisplayInetrnetConnecting();
  17. DWORD CheckWithDisplayInterNetConnectingMsg(HINSTANCE hIns);
  18. void SetMSID(HINSTANCE hInstance);
  19. BOOL GetMSIDfromRegistry(HINSTANCE hInstance,LPTSTR szValue);
  20. BOOL GetMSIDfromCookie(HINSTANCE hInstance,LPTSTR szMSID);
  21. DWORD_PTR GetProxyAuthenticationInfo(HINSTANCE hIns,TCHAR *czProxy,
  22. TCHAR *czUserName,TCHAR *czPswd);
  23. void RemoveMSIDEntry(HINSTANCE hIns);
  24. #ifdef __cplusplus
  25. }
  26. #endif
  27. TCHAR * GetModemDeviceInformation(HINSTANCE hIns, int iModemIndex);
  28. //
  29. // Status returend while finding the removable media and cdrom
  30. //
  31. #define REGFIND_ERROR 1
  32. #define REGFIND_RECURSE 2
  33. #define REGFIND_FINISH 3
  34. //
  35. // Status returend while Cheching for InternetConnection
  36. //
  37. #define DIALUP_NOT_REQUIRED 1
  38. #define DIALUP_REQUIRED 2
  39. //#define CONNECTION_CANNOT_BE_ESTABLISHED 3
  40. //
  41. // HTTP Post related status messages
  42. //
  43. #define RWZ_NOERROR 0
  44. #define RWZ_NO_INFO_AVAILABLE 1
  45. #define RWZ_INVALID_INFORMATION 2
  46. #define RWZ_BUFFER_SIZE_INSUFFICIENT 3
  47. #define RWZ_INTERNAL_ERROR 4 // Internal Programming Error
  48. #define RWZ_POST_SUCCESS 5
  49. #define RWZ_POST_FAILURE 6
  50. #define RWZ_POST_WITH_SSL_FAILURE 7
  51. #define RWZ_POST_MSN_SITE_BUSY 8
  52. #define RWZ_ERROR_NOTCPIP 9
  53. //
  54. // Error Values returned by the Signup Dialogue
  55. //
  56. #define RWZ_ERROR_LOCATING_MSN_FILES 10
  57. #define RWZ_ERROR_LOCATING_DUN_FILES 11
  58. #define RWZ_ERROR_MODEM_IN_USE 12
  59. #define RWZ_ERROR_MODEM_CFG_ERROR 13
  60. #define RWZ_ERROR_TXFER_CANCELLED_BY_USER 14
  61. #define RWZ_ERROR_CANCELLED_BY_USER 14
  62. #define RWZ_ERROR_SYSTEMERROR 15
  63. #define RWZ_ERROR_NODIALTONE 16
  64. // Environment Not proper
  65. #define RWZ_ERROR_MODEM_NOT_FOUND 17
  66. #define RWZ_ERROR_NO_ANSWER 18 // no response engaged tone
  67. #define RWZ_ERROR_RASDLL_NOTFOUND 19
  68. #define CONNECTION_CANNOT_BE_ESTABLISHED 20 // Mdem cfg error
  69. // Error in Invoking
  70. #define RWZ_ERROR_INVALID_PARAMETER 30
  71. #define RWZ_ERROR_INVALID_DLL 31
  72. #define REGWIZ_ALREADY_CONFIGURED 32
  73. #define RWZ_ERROR_PREVIOUSCOPY_FOUND 33
  74. #define RWZ_ERROR_REGISTERLATER 34
  75. // Status of Ping
  76. #define RWZ_PINGSTATUS_NOTCPIP 40
  77. #define RWZ_PINGSTATUS_SUCCESS 41
  78. #define RWZ_PINGSTATUS_FAIL 42
  79. //
  80. // The below defines is for creating a Log File
  81. //
  82. #define _LOG_IN_FILE // uses a file
  83. class RWDebug {
  84. public:
  85. RWDebug() {
  86. m_iError = 0;
  87. fp = NULL;
  88. };
  89. ~RWDebug(){};
  90. void UseStandardOutput();
  91. void CreateLogFile(char *czFile);
  92. inline RWDebug& operator<<(RWDebug& (__cdecl * _f)(RWDebug&));
  93. RWDebug& operator <<( int iv) ;
  94. RWDebug& operator <<( unsigned int iv) ;
  95. RWDebug& operator <<( short sv) ;
  96. RWDebug& operator <<( unsigned short usv) ;
  97. RWDebug& operator <<( const unsigned short *usv) ;
  98. RWDebug& operator <<( void * pVoid) ;
  99. RWDebug& operator <<( long lv) ;
  100. RWDebug& operator <<( unsigned long ulv) ;
  101. RWDebug& operator <<( float fv) ;
  102. RWDebug& operator <<( char cv) ;
  103. //RWDebug& operator <<( bool bv) ;
  104. RWDebug& operator <<( char * sv) ;
  105. RWDebug& operator <<( unsigned char * sv) ;
  106. RWDebug& operator <<( const char * sv) ;
  107. RWDebug& flush() {return *this;};
  108. RWDebug& Write (char *czT);
  109. private :
  110. FILE *fp;
  111. char czTemp[48];
  112. int m_iError;
  113. };
  114. inline RWDebug& RWDebug::operator<<(RWDebug& (__cdecl * _f)(RWDebug&)) { (*_f)(*this); return *this; }
  115. inline RWDebug& __cdecl flush(RWDebug& _outs) { return _outs.flush(); }
  116. inline RWDebug& __cdecl endl(RWDebug& _outs) { return _outs << '\n' << flush; }
  117. //ostream &GetDebugLogStream();
  118. RWDebug &GetDebugLogStream();
  119. REGSAM RW_GetSecDes() ;
  120. int GetProductRoot (TCHAR * pPath , PHKEY phKey);
  121. #define RW_DEBUG GetDebugLogStream()
  122. /*
  123. Function name : RegFindValueInAllSubKey
  124. Description : It searches the subkey for the presence of the ValueName "Type" which has
  125. value given by szValueToFind.It returns the value of "Identifier"
  126. ValueName present along with the type in szIdentifier.
  127. Return Value : TRUE if Successful else FALSE
  128. */
  129. int RegFindValueInAllSubKey(HINSTANCE hInstance,HKEY key ,LPCTSTR szSubKeyNameToFind,LPCTSTR szValueToFind,LPTSTR szIdentifier,int nType );
  130. /*
  131. Function name : RegFindTheSubKey
  132. Description : Finds the key specified within the subkey.
  133. Return Value : TRUE if Successful else FALSE
  134. */
  135. BOOL RegFindTheSubKey(HKEY key,LPCTSTR szSubKeyName,LPCTSTR szSubKeyNameToFind,LPTSTR szData);
  136. /*
  137. Function name : RegGetPointingDevice
  138. Description : Get the pointing device.
  139. Return Value : TRUE if Successful else FALSE
  140. */
  141. BOOL RegGetPointingDevice(HKEY hKey,LPCTSTR szSubKeyName,LPTSTR szData);
  142. LPCTSTR BstrToSz(BSTR pszW);
  143. #ifdef _UNICODE
  144. TCHAR* ConvertToUnicode(char FAR* szA);
  145. #else
  146. TCHAR * ConvertToUnicode(TCHAR * szW) ;
  147. #endif
  148. char * ConvertToANSIString (LPCTSTR szW);
  149. int IsDialupConnectionActive();
  150. HRESULT GetNewGUID(PSTR pszGUID);
  151. //
  152. //
  153. // Internet connection settings related function
  154. // define ATK_INET.CPP
  155. int DisableAutoDial(); // Disables Auto Dial
  156. int ResetAutoDialConfiguration();
  157. void GetAutoDialConfiguration();
  158. void UnLoadInetCfgLib();
  159. //
  160. //
  161. // product Info related function
  162. void SetProductBeingRegistred(TCHAR *szProduct);
  163. TCHAR *GetProductBeingRegistred();
  164. //
  165. // OEM DLL Validation
  166. #define OEM_NO_ERROR 0
  167. #define OEM_VALIDATE_FAILED 1
  168. #define OEM_INTERNAL_ERROR 2
  169. int CheckOEMdll(); // This checks if Registration is with OEM
  170. int GetOemManufacturer (TCHAR *szProductregKey, TCHAR *szBuf );
  171. #endif