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.

129 lines
2.6 KiB

  1. /******************************Module*Header*******************************\
  2. * Module Name: uidemo.cxx
  3. *
  4. * Copyright (c) 1997 Microsoft Corporation
  5. *
  6. \**************************************************************************/
  7. #include <stdio.h>
  8. #include <string.h>
  9. #include <math.h>
  10. #include <sys/types.h>
  11. #include <stdlib.h>
  12. #include <time.h>
  13. #include "uidemo.hxx"
  14. #include "resource.h"
  15. // global mocked up environment
  16. ENV *pEnv;
  17. BOOL bContextMode = FALSE;
  18. #define OBJECTS 4
  19. TEX_RES texRes[OBJECTS] =
  20. {
  21. {TEX_BMP, IDB_USER0},
  22. {TEX_BMP, IDB_USER1},
  23. {TEX_BMP, IDB_USER2},
  24. {TEX_BMP, IDB_USER3}
  25. };
  26. /**************************************************************************\
  27. * ENV
  28. *
  29. \**************************************************************************/
  30. ENV::ENV(int argc, char **argv)
  31. {
  32. GLint i;
  33. // Process command line arguments
  34. bDebugMode = FALSE;
  35. for (i = 1; i < argc; i++) {
  36. if (strcmp(argv[i], "-d") == 0) {
  37. bDebugMode = GL_TRUE;
  38. } else if (strcmp(argv[i], "-c") == 0) {
  39. bContextMode = GL_TRUE;
  40. } else {
  41. printf("%s (Bad option).\n", argv[i]);
  42. }
  43. }
  44. // Initial setup : load texture file, etc.
  45. nUsers = OBJECTS;
  46. SS_ASSERT( nUsers <= MAX_USERS, "Too many users\n" );
  47. iSelectedUser = -1;
  48. pUserTexRes = texRes;
  49. hInstance = GetModuleHandle( NULL );
  50. }
  51. ENV::ENV()
  52. {
  53. bDebugMode = FALSE;
  54. nUsers = OBJECTS;
  55. SS_ASSERT( nUsers <= MAX_USERS, "Too many users\n" );
  56. iSelectedUser = -1;
  57. pUserTexRes = texRes;
  58. }
  59. ENV::~ENV()
  60. {
  61. }
  62. //mf: since called by c file
  63. extern "C"
  64. int Run3DLogon( HINSTANCE hInst )
  65. {
  66. pEnv = new ENV();
  67. if( !pEnv )
  68. return -1;
  69. pEnv->hInstance = hInst;
  70. RunLogonSequence( pEnv );
  71. return pEnv->iSelectedUser;
  72. }
  73. /**************************************************************************\
  74. * main
  75. *
  76. \**************************************************************************/
  77. void main(int argc, char **argv)
  78. {
  79. // Create global environment, using cmd line arguments.
  80. // This is a mocked up environment, similar to what RunLogonSequence()
  81. // should really be called with
  82. pEnv = new ENV( argc, argv );
  83. if( !pEnv )
  84. return;
  85. #if 1
  86. #if 0
  87. if( bContextMode )
  88. // Do context menu
  89. RunContextMenuSequence( pEnv );
  90. else
  91. #endif
  92. // This opens the window, runs logon sequence, and closes window
  93. //mf: This should return the chosen logon object...
  94. RunLogonSequence( pEnv );
  95. #else
  96. //mf: try running both !
  97. RunLogonSequence( pEnv );
  98. RunContextMenuSequence( pEnv );
  99. #endif
  100. delete pEnv;
  101. }