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.

327 lines
9.9 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1993.
  5. //
  6. // File: testgina.h
  7. //
  8. // Contents: Main header file for testgina.exe
  9. //
  10. // History: 7-14-94 RichardW Created
  11. //
  12. //----------------------------------------------------------------------------
  13. #define UNICODE
  14. #ifndef RC_INVOKED
  15. #include <nt.h>
  16. #include <ntrtl.h>
  17. #include <nturtl.h>
  18. #include <ntlsa.h>
  19. #include <ntmsv1_0.h>
  20. #include <lmsname.h>
  21. #endif
  22. #include <windows.h>
  23. #include <shellapi.h>
  24. #include <commctrl.h>
  25. #include <stdio.h>
  26. #ifndef RC_INVOKED
  27. #include <winwlx.h>
  28. typedef
  29. BOOL (WINAPI * PWLX_NEGOTIATE)(
  30. DWORD, DWORD *);
  31. typedef
  32. BOOL (WINAPI * PWLX_INITIALIZE)(
  33. LPWSTR, HANDLE, PVOID, PVOID, PVOID *);
  34. typedef
  35. VOID (WINAPI * PWLX_DISPLAYSASNOTICE)(
  36. PVOID );
  37. typedef
  38. int (WINAPI * PWLX_LOGGEDOUTSAS)(
  39. PVOID, DWORD, PLUID, PSID, PDWORD, PHANDLE, PWLX_MPR_NOTIFY_INFO, PVOID);
  40. typedef
  41. VOID (WINAPI * PWLX_ACTIVATEUSERSHELL)(
  42. PVOID, PWSTR, PWSTR, PVOID);
  43. typedef
  44. int (WINAPI * PWLX_LOGGEDONSAS)(
  45. PVOID, DWORD, PWLX_MPR_NOTIFY_INFO);
  46. typedef
  47. VOID (WINAPI * PWLX_DISPLAYLOCKEDNOTICE)(
  48. PVOID );
  49. typedef
  50. int (WINAPI * PWLX_WKSTALOCKEDSAS)(
  51. PVOID, DWORD );
  52. typedef
  53. VOID (WINAPI * PWLX_LOGOFF)(
  54. PVOID );
  55. typedef
  56. VOID (WINAPI * PWLX_SHUTDOWN)(
  57. PVOID );
  58. #define WLX_NEGOTIATE_NAME "WlxNegotiate"
  59. #define WLX_INITIALIZE_NAME "WlxInitialize"
  60. #define WLX_DISPLAYSASNOTICE_NAME "WlxDisplaySASNotice"
  61. #define WLX_LOGGEDOUTSAS_NAME "WlxLoggedOutSAS"
  62. #define WLX_ACTIVATEUSERSHELL_NAME "WlxActivateUserShell"
  63. #define WLX_LOGGEDONSAS_NAME "WlxLoggedOnSAS"
  64. #define WLX_DISPLAYLOCKED_NAME "WlxDisplayLockedNotice"
  65. #define WLX_WKSTALOCKEDSAS_NAME "WlxWkstaLockedSAS"
  66. #define WLX_LOGOFF_NAME "WlxLogoff"
  67. #define WLX_SHUTDOWN_NAME "WlxShutdown"
  68. #define WLX_NEGOTIATE_API 0
  69. #define WLX_INITIALIZE_API 1
  70. #define WLX_DISPLAYSASNOTICE_API 2
  71. #define WLX_LOGGEDOUTSAS_API 3
  72. #define WLX_ACTIVATEUSERSHELL_API 4
  73. #define WLX_LOGGEDONSAS_API 5
  74. #define WLX_DISPLAYLOCKED_API 6
  75. #define WLX_WKSTALOCKEDSAS_API 7
  76. #define WLX_LOGOFF_API 8
  77. #define WLX_SHUTDOWN_API 9
  78. typedef enum _WinstaState {
  79. Winsta_PreLoad,
  80. Winsta_Initialize,
  81. Winsta_NoOne,
  82. Winsta_NoOne_Display,
  83. Winsta_NoOne_SAS,
  84. Winsta_LoggedOnUser_StartShell,
  85. Winsta_LoggedOnUser,
  86. Winsta_LoggedOn_SAS,
  87. Winsta_Locked,
  88. Winsta_Locked_SAS,
  89. Winsta_WaitForShutdown,
  90. Winsta_Shutdown
  91. } WinstaState;
  92. typedef struct _USER_SAS {
  93. DWORD Value;
  94. WCHAR Name[128];
  95. } USER_SAS, * PUSER_SAS;
  96. #define MAX_USER_SASES 4
  97. #define UPDATE_INITIALIZE 0
  98. #define UPDATE_DISPLAY_NOTICE 1
  99. #define UPDATE_SAS_RECEIVED 2
  100. #define UPDATE_USER_LOGON 3
  101. #define UPDATE_LOCK_WKSTA 4
  102. #define UPDATE_UNLOCK_WKSTA 5
  103. #define UPDATE_LOGOFF 6
  104. #define UPDATE_SAS_BYPASS 7
  105. #define UPDATE_SAS_COMPLETE 8
  106. #define UDPATE_FORCE_LOGOFF 9
  107. #define UPDATE_SHUTDOWN 10
  108. void
  109. UpdateGinaState(DWORD Update);
  110. void TestGinaError(DWORD, PWSTR);
  111. #define GINAERR_INVALID_HANDLE 1
  112. #define GINAERR_IMPROPER_CAD 2
  113. #define GINAERR_INVALID_LEVEL 3
  114. #define GINAERR_LOAD_FAILED 4
  115. #define GINAERR_MISSING_FUNCTION 5
  116. #define GINAERR_UNKNOWN_HWND 6
  117. #define GINAERR_NO_WINDOW_FOR_SAS 7
  118. #define GINAERR_INVALID_SAS_CODE 8
  119. #define GINAERR_INVALID_RETURN 9
  120. #define GINAERR_DIALOG_ERROR 10
  121. #define MAX_DESKTOPS 16
  122. #define WINLOGON_DESKTOP 0
  123. #define DEFAULT_DESKTOP 1
  124. #define SCREENSAVER_DESKTOP 2
  125. void LoadParameters(void);
  126. void SaveParameters(void);
  127. void
  128. SaveGinaSpecificParameters(void);
  129. void
  130. LoadGinaSpecificParameters(
  131. VOID );
  132. VOID
  133. UpdateSasMenu(VOID);
  134. VOID
  135. EnableOptions(BOOL Enable);
  136. VOID WINAPI WlxUseCtrlAltDel(HANDLE);
  137. VOID WINAPI WlxSasNotify(HANDLE, DWORD);
  138. VOID WINAPI WlxSetContextPointer(HANDLE, PVOID);
  139. BOOL WINAPI WlxSetTimeout(HANDLE, DWORD);
  140. int WINAPI WlxAssignShellProtection(HANDLE, HANDLE, HANDLE, HANDLE);
  141. int WINAPI WlxMessageBox(HANDLE, HWND, LPWSTR, LPWSTR, UINT);
  142. int WINAPI WlxDialogBox(HANDLE, HANDLE, LPWSTR, HWND, DLGPROC);
  143. int WINAPI WlxDialogBoxIndirect(HANDLE, HANDLE, LPCDLGTEMPLATE, HWND, DLGPROC);
  144. int WINAPI WlxDialogBoxParam(HANDLE, HANDLE, LPWSTR, HWND, DLGPROC, LPARAM);
  145. int WINAPI WlxDialogBoxIndirectParam(HANDLE, HANDLE, LPCDLGTEMPLATE, HWND, DLGPROC, LPARAM);
  146. int WINAPI WlxSwitchDesktopToUser(HANDLE);
  147. int WINAPI WlxSwitchDesktopToWinlogon(HANDLE);
  148. int WINAPI WlxChangePasswordNotify(HANDLE, PWLX_MPR_NOTIFY_INFO, DWORD);
  149. BOOL WINAPI WlxGetSourceDesktop(HANDLE, PWLX_DESKTOP *);
  150. BOOL WINAPI WlxSetReturnDesktop(HANDLE, PWLX_DESKTOP);
  151. BOOL WINAPI WlxCreateUserDesktop(HANDLE, HANDLE, DWORD, PWSTR, PWLX_DESKTOP *);
  152. int WINAPI WlxChangePasswordNotifyEx( HANDLE, PWLX_MPR_NOTIFY_INFO, DWORD, PWSTR, PVOID);
  153. BOOL WINAPI WlxCloseUserDesktop( HANDLE, PWLX_DESKTOP, HANDLE );
  154. BOOL WINAPI WlxSetOption( HANDLE, DWORD, ULONG_PTR, ULONG_PTR * );
  155. BOOL WINAPI WlxGetOption( HANDLE, DWORD, ULONG_PTR * );
  156. VOID WINAPI WlxWin31Migrate( HANDLE );
  157. BOOL WINAPI WlxQueryClientCredentials( PWLX_CLIENT_CREDENTIALS_INFO_V1_0 );
  158. BOOL WINAPI WlxQueryICCredentials( PWLX_CLIENT_CREDENTIALS_INFO_V1_0 );
  159. BOOL WINAPI WlxDisconnect( VOID );
  160. int UpdateMenuBar(void);
  161. void UpdateStatusBar(void);
  162. PingSAS(DWORD SasType);
  163. BOOLEAN LoadGinaDll(void);
  164. BOOLEAN TestNegotiate(void);
  165. BOOLEAN TestInitialize(void);
  166. BOOLEAN TestDisplaySASNotice(void);
  167. int TestLoggedOutSAS(int SasType);
  168. int TestLoggedOnSAS(int SasType);
  169. int TestActivateUserShell(void);
  170. int TestWkstaLockedSAS(int SasType);
  171. int TestDisplayLockedNotice(void);
  172. int TestLogoff(void);
  173. BOOL
  174. InitializeDesktops( VOID );
  175. BOOLEAN AmIBeingDebugged(void);
  176. void LogEvent(long Mask, const char * Format, ...);
  177. LRESULT
  178. CALLBACK
  179. WndProc(
  180. HWND hWnd,
  181. UINT Message,
  182. WPARAM wParam,
  183. LPARAM lParam);
  184. BOOL AssociateHandle(HANDLE);
  185. BOOL VerifyHandle(HANDLE);
  186. BOOL StashContext(PVOID);
  187. PVOID GetContext(VOID);
  188. BOOL
  189. ValidResponse(
  190. DWORD ApiNum,
  191. DWORD Response);
  192. //
  193. // Global Variables
  194. extern HINSTANCE hDllInstance;
  195. extern HINSTANCE hAppInstance;
  196. extern DWORD DllVersion;
  197. extern HICON hIcon;
  198. extern HWND hMainWindow;
  199. extern HWND hStatusWindow;
  200. extern DWORD StatusHeight;
  201. extern DWORD fTestGina;
  202. extern DWORD GinaBreakFlags;
  203. extern WinstaState GinaState;
  204. extern DWORD LastRetCode;
  205. extern BOOL LastBoolRet;
  206. extern WCHAR szGinaDll[];
  207. extern WLX_DISPATCH_VERSION_1_3 WlxDispatchTable;
  208. extern HANDLE hThread;
  209. extern DWORD SizeX, SizeY;
  210. extern DWORD PosX, PosY;
  211. extern DWORD StatusDeltaX, StatusDeltaY;
  212. extern DWORD StatusHeight;
  213. extern WLX_MPR_NOTIFY_INFO GlobalMprInfo;
  214. extern HMENU hDebugMenu;
  215. extern USER_SAS UserDefSas[4];
  216. extern DWORD UserSases;
  217. extern PVOID pWlxContext;
  218. extern WCHAR GlobalProviderName[];
  219. extern DWORD CurrentDesktop;
  220. extern PWLX_DESKTOP Desktops[];
  221. extern DWORD OtherDesktop;
  222. extern DWORD DesktopCount;
  223. #define WLX_SAS_ACTION_BOOL_RET 12
  224. //
  225. // Function Pointers in DLL:
  226. //
  227. extern PWLX_NEGOTIATE pWlxNegotiate;
  228. extern PWLX_INITIALIZE pWlxInitialize;
  229. extern PWLX_DISPLAYSASNOTICE pWlxDisplaySASNotice;
  230. extern PWLX_LOGGEDOUTSAS pWlxLoggedOutSAS;
  231. extern PWLX_ACTIVATEUSERSHELL pWlxActivateUserShell;
  232. extern PWLX_LOGGEDONSAS pWlxLoggedOnSAS;
  233. extern PWLX_DISPLAYLOCKEDNOTICE pWlxDisplayLockedNotice;
  234. extern PWLX_WKSTALOCKEDSAS pWlxWkstaLockedSAS;
  235. extern PWLX_LOGOFF pWlxLogoff;
  236. extern PWLX_SHUTDOWN pWlxShutdown;
  237. #define GINA_USE_CAD 0x00000001 // DLL requested Use CAD
  238. #define GINA_DLL_KNOWN 0x00000002 // DLL name has been determined
  239. #define GINA_USE_SC 0x00000004
  240. #define GINA_NEGOTIATE_OK 0x80000000 // Ok to call Negotiate
  241. #define GINA_INITIALIZE_OK 0x40000000 // Ok to call Initialize
  242. #define GINA_LOGGEDOUT_OK 0x20000000 // Ok to call LoggedOutSAS
  243. #define GINA_ACTIVATE_OK 0x10000000 // Ok to call Activate
  244. #define GINA_LOGGEDON_OK 0x08000000 // Ok to call LoggedOnSAS
  245. #define GINA_DISPLAYLOCK_OK 0x04000000 // Ok to call DisplayLockedNotice
  246. #define GINA_WKSTALOCK_OK 0x02000000 // Ok to call WkstaLockedSAS
  247. #define GINA_LOGOFF_OK 0x01000000 // Ok to call Logoff
  248. #define GINA_SHUTDOWN_OK 0x00800000 // Ok to call Shutdown
  249. #define GINA_DISPLAY_OK 0x00400000 // Ok to call Display
  250. #define GINA_ISLOCKOK_OK 0x00200000 // Ok to call IsLockOk
  251. #define GINA_ISLOGOFFOK_OK 0x00100000 // Ok to call IsLogoffOk
  252. #define GINA_RESTART_OK 0x00080000 // Ok to call RestartShell
  253. #define GINA_SCREENSAVE_OK 0x00040000 // Ok to call ScreenSaverNotify
  254. #define GINA_DISPLAYLOG_OK 0x00020000
  255. #define BREAK_NEGOTIATE 0x00000001
  256. #define BREAK_INITIALIZE 0x00000002
  257. #define BREAK_DISPLAY 0x00000004
  258. #define BREAK_LOGGEDOUT 0x00000008
  259. #define BREAK_ACTIVATE 0x00000010
  260. #define BREAK_LOGGEDON 0x00000020
  261. #define BREAK_DISPLAYLOCKED 0x00000040
  262. #define BREAK_WKSTALOCKED 0x00000080
  263. #define BREAK_LOGOFF 0x00000100
  264. #define BREAK_SHUTDOWN 0x00000200
  265. #define FLAG_ON(dw, f) dw |= (f)
  266. #define FLAG_OFF(dw, f) dw &= (~(f))
  267. #define TEST_FLAG(dw, f) ((BOOL)(dw & (f)))
  268. #endif // RC_INVOKED
  269. #include "menu.h"
  270. #include "dialogs.h"
  271. #define TESTGINAICON 10