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.

235 lines
9.6 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1998.
  5. //
  6. // File: Reg.h
  7. //
  8. // Contents: Registration routines
  9. //
  10. // Classes:
  11. //
  12. // Notes:
  13. //
  14. // History: 05-Nov-97 rogerg Created.
  15. //
  16. //--------------------------------------------------------------------------
  17. #ifndef _CONESTOPREGISTER_
  18. #define _CONESTOPREGISTER_
  19. #include "rasui.h" // included so exe can inlude dll.reg.
  20. #define GUID_SIZE 128
  21. #define MAX_STRING_LENGTH 256
  22. typedef
  23. enum _tagSYNCTYPE
  24. {
  25. SYNCTYPE_MANUAL = 0x1,
  26. SYNCTYPE_AUTOSYNC = 0x2,
  27. SYNCTYPE_IDLE = 0x3,
  28. SYNCTYPE_SCHEDULED = 0x4,
  29. SYNCTYPE_PROGRESS = 0x5
  30. } SYNCTYPE;
  31. EXTERN_C void WINAPI RunDllRegister(HWND hwnd,
  32. HINSTANCE hAppInstance,
  33. LPSTR pszCmdLine,
  34. int nCmdShow);
  35. #define UL_DEFAULTIDLEWAITMINUTES 15
  36. #define UL_DEFAULTIDLERETRYMINUTES 60
  37. #define UL_DELAYIDLESHUTDOWNTIME 2*1000 // time in milliseconds
  38. #define UL_DEFAULTWAITMINUTES 15
  39. #define UL_DEFAULTREPEATSYNCHRONIZATION 1
  40. #define UL_DEFAULTFRUNONBATTERIES 0
  41. typedef struct _CONNECTIONSETTINGS {
  42. TCHAR pszConnectionName[RAS_MaxEntryName + 1]; //The connection
  43. DWORD dwConnType;
  44. // DWORD dwSyncFlags;
  45. // For optimization: these are currently all BOOL,
  46. //the first three are used exclusively for autosync,
  47. //and dwMakeConnection is used exclusively for sched sync.
  48. //Consider using bitfields and/or a union to consolidate space.
  49. // AutoSync settings
  50. DWORD dwLogon; //Autosync at logon
  51. DWORD dwLogoff; //Autosync at logoff
  52. DWORD dwPromptMeFirst; //Prompt the user first before autosyncing
  53. // Schedule settings.
  54. DWORD dwMakeConnection; //Automatically try to establish the connection
  55. // Idle Settings
  56. DWORD dwIdleEnabled; // Idle is enabled on this connection
  57. // Idle Settings that are really not per connection but read in for
  58. // convenience. These are currently never written.
  59. ULONG ulIdleWaitMinutes; // number of minutes to wait after idle to start idle processing.
  60. ULONG ulIdleRetryMinutes; // number of minutes for Idle before retry.
  61. ULONG ulDelayIdleShutDownTime; // time to delay shutdown of idle in milliseconds
  62. DWORD dwRepeatSynchronization; // indicates synchronization should be repeated
  63. DWORD dwRunOnBatteries; // indicates whether to run on batteries or not.
  64. DWORD dwHidden; //Hide the schedule from the user because this is a publishers sched.
  65. DWORD dwReadOnly; //Schedule info is readonly
  66. } CONNECTIONSETTINGS;
  67. typedef CONNECTIONSETTINGS *LPCONNECTIONSETTINGS;
  68. STDAPI_(BOOL) AddRegNamedValue(HKEY hkey,LPTSTR pszKey,LPTSTR pszSubkey,LPTSTR pszValueName,LPTSTR pszValue);
  69. STDAPI_(BOOL) RegLookupSettings(HKEY hKeyUser,
  70. CLSID clsidHandler,
  71. SYNCMGRITEMID ItemID,
  72. const TCHAR *pszConnectionName,
  73. DWORD *pdwCheckState);
  74. STDAPI_(BOOL) RegWriteOutSettings(HKEY hKeyUser,
  75. CLSID clsidHandler,
  76. SYNCMGRITEMID ItemID,
  77. const TCHAR *pszConnectionName,
  78. DWORD dwCheckState);
  79. STDAPI_(BOOL) RegGetSyncItemSettings(DWORD dwSyncType,
  80. CLSID clsidHandler,
  81. SYNCMGRITEMID ItemId,
  82. const TCHAR *pszConnectionName,
  83. DWORD *pdwCheckState,
  84. DWORD dwDefaultCheckState,
  85. TCHAR *pszSchedName);
  86. STDAPI_(BOOL) RegSetSyncItemSettings(DWORD dwSyncType,
  87. CLSID clsidHandler,
  88. SYNCMGRITEMID ItemId,
  89. const TCHAR *pszConnectionName,
  90. DWORD dwCheckState,
  91. TCHAR *pszSchedName);
  92. STDAPI_(BOOL) RegSetSyncHandlerSettings(DWORD syncType,
  93. const TCHAR *pszConnectionName,
  94. CLSID clsidHandler,
  95. BOOL fItemsChecked);
  96. STDAPI_(BOOL) RegQueryLoadHandlerOnEvent(TCHAR *pszClsid,DWORD dwSyncFlags,
  97. TCHAR *pConnectionName);
  98. //Progress dialog preference
  99. STDAPI_(BOOL) RegGetProgressDetailsState(REFCLSID clsidDlg,BOOL *pfPushPin, BOOL *pfExpanded);
  100. STDAPI_(BOOL) RegSetProgressDetailsState(REFCLSID clsidDlg,BOOL fPushPin, BOOL fExpanded);
  101. //Autosync reg functions
  102. STDAPI_(BOOL) RegGetAutoSyncSettings(LPCONNECTIONSETTINGS lpConnectionSettings);
  103. STDAPI_(BOOL) RegSetAutoSyncSettings(LPCONNECTIONSETTINGS lpConnectionSettings,
  104. int iNumConnections,
  105. CRasUI *pRas,
  106. BOOL fCleanReg,
  107. BOOL fSetMachineState,
  108. BOOL fPerUser);
  109. // Idle reg functions
  110. STDAPI_(BOOL) RegGetIdleSyncSettings(LPCONNECTIONSETTINGS lpConnectionSettings);
  111. STDAPI_(BOOL) RegSetIdleSyncSettings(LPCONNECTIONSETTINGS lpConnectionSettings,
  112. int iNumConnections,
  113. CRasUI *pRas,
  114. BOOL fCleanReg,
  115. BOOL fPerUser);
  116. STDAPI_(BOOL) RegRegisterForIdleTrigger(BOOL fRegister,ULONG ulWaitMinutes,BOOL fRunOnBatteries);
  117. // function for exporting settings for exe
  118. STDAPI_(BOOL) RegGetSyncSettings(DWORD dwSyncType,LPCONNECTIONSETTINGS lpConnectionSettings);
  119. //Scheduled Sync reg functions
  120. STDAPI_(BOOL) RegSchedHandlerItemsChecked(TCHAR *pszHandlerName,
  121. TCHAR *pszConnectionName,
  122. TCHAR *pszScheduleName);
  123. STDAPI_(BOOL) RegGetSchedSyncSettings( LPCONNECTIONSETTINGS lpConnectionSettings,TCHAR *pszSchedName);
  124. STDAPI_(BOOL) RegSetSchedSyncSettings( LPCONNECTIONSETTINGS lpConnectionSettings,TCHAR *pszSchedName);
  125. STDAPI_(BOOL) RegGetSchedFriendlyName(LPCTSTR ptszScheduleGUIDName,
  126. LPTSTR ptstrFriendlyName);
  127. STDAPI_(BOOL) RegSetSchedFriendlyName(LPCTSTR ptszScheduleGUIDName,
  128. LPCTSTR ptstrFriendlyName);
  129. STDAPI_(BOOL) RegGetSchedConnectionName(TCHAR *pszSchedName,
  130. TCHAR *pszConnectionName,
  131. DWORD cbConnectionName);
  132. STDAPI_(BOOL) RegSetSIDForSchedule(TCHAR *pszSchedName);
  133. STDAPI_(BOOL) RegGetSIDForSchedule(TCHAR *ptszTextualSidSched,
  134. DWORD *dwSizeSid,
  135. TCHAR *pszSchedName);
  136. STDAPI_(BOOL) RegRemoveScheduledTask(TCHAR *pszTaskName);
  137. STDAPI_(BOOL) RemoveScheduledJobFile(TCHAR *pszTaskName);
  138. STDAPI_(BOOL) RegRegisterForScheduledTasks(BOOL fScheduled);
  139. STDAPI_(BOOL) RegUninstallSchedules();
  140. STDAPI_(BOOL) RegFixRunKey();
  141. STDAPI_(DWORD) RegDeleteKeyNT(HKEY hStartKey , LPCWSTR pKeyName);
  142. // Manual settings
  143. STDAPI_(BOOL) RegRemoveManualSyncSettings(TCHAR *pszConnectionName);
  144. // Handler Registration Functions.
  145. STDAPI_(BOOL) RegRegisterHandler(REFCLSID rclsidHandler,
  146. WCHAR const *pwszDescription,
  147. DWORD dwSyncMgrRegisterFlags,
  148. BOOL *pfFirstRegistration);
  149. STDAPI_(BOOL) RegRegRemoveHandler(REFCLSID rclsidHandler);
  150. STDAPI_(BOOL) RegGetHandlerRegistrationInfo(REFCLSID rclsidHandler,LPDWORD pdwSyncMgrRegisterFlags);
  151. STDAPI_(void) RegSetUserDefaults();
  152. STDAPI_(void) RegSetAutoSyncDefaults(BOOL fLogon,BOOL fLogoff);
  153. STDAPI_(void) RegSetIdleSyncDefaults(BOOL fIdle);
  154. STDAPI RegSetUserAutoSyncDefaults(DWORD dwSyncMgrRegisterMask,
  155. DWORD dwSyncMgrRegisterFlags);
  156. STDAPI RegSetUserIdleSyncDefaults(DWORD dwSyncMgrRegisterMask,
  157. DWORD dwSyncMgrRegisterFlags);
  158. STDAPI RegGetUserRegisterFlags(LPDWORD pdwSyncMgrRegisterFlags);
  159. STDAPI_(BOOL) RegWriteTimeStamp(HKEY hkey);
  160. STDAPI_(BOOL) RegGetTimeStamp(HKEY hKey, FILETIME *pft);
  161. STDAPI_(void) RegUpdateTopLevelKeys();
  162. // common registry functions.
  163. STDAPI_(HKEY) RegOpenUserKey(HKEY hkeyParent,REGSAM samDesired,BOOL fCreate,BOOL fCleanReg);
  164. STDAPI_(HKEY) RegGetSyncTypeKey(DWORD dwSyncType,REGSAM samDesired,BOOL fCreate);
  165. STDAPI_(HKEY) RegGetCurrentUserKey(DWORD dwSyncType,REGSAM samDesired,BOOL fCreate);
  166. STDAPI_(HKEY) RegGetHandlerTopLevelKey(REGSAM samDesired);
  167. STDAPI_(HKEY) RegGetHandlerKey(HKEY hkeyParent,LPCWSTR pszHandlerClsid,REGSAM samDesired,BOOL fCreate);
  168. // EventService/Winlogon Registration
  169. #if 0
  170. // define regkeys for WinLogon Registration
  171. // WinLogon is registered undler HKLM
  172. #define WINLOGON_NOTIFY "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\notify"
  173. #define WINLOGON_SYNCMGRDLLNAME "syncmgrp.dll"
  174. #define WINLOGON_LOGONVALUE TEXT("StartShell")
  175. #define WINLOGON_LOGOFFVALUE TEXT("Logoff")
  176. #define WINLOGON_DLLNAMEVALUE TEXT("DllName")
  177. #define WINLOGON_LOGONEXPORT TEXT("WinLogonEvent")
  178. #define WINLOGON_LOGOFFEXPORT TEXT("WinLogoffEvent")
  179. #define WINLOGON_NOTIFYKEYNAME TEXT(WINLOGON_NOTIFY)
  180. #define WINLOGON_SYNCMGRNOTIFYKEYNAME TEXT(WINLOGON_SYNCMGRDLLNAME)
  181. #define WINLOGON_SYNCMGRKEYFULLPATH TEXT(WINLOGON_NOTIFY##"\\"##WINLOGON_SYNCMGRDLLNAME)
  182. #endif
  183. STDAPI RegRegisterForEvents(BOOL fUninstall);
  184. #endif // _CONESTOPREGISTER_