home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / sdk / netds / sna / aremote / arsetup.h < prev    next >
C/C++ Source or Header  |  1997-04-09  |  5KB  |  123 lines

  1. #include "setupdlg.h"
  2. #define MAXREGPATHLEN    1024         // Max length of registry path
  3. #define MAXTPLEN    128             // Max length of TP name
  4. #define MAXBINPATHLEN   256             // Max length of file path
  5. #define MAXPARAMLEN      128            // Max length of command-line parameters
  6. #define MAXUSERNAMELEN  32        // Max length of username
  7. #define MAXPASSWORDLEN  32        // Max length of password
  8. #define MAXLULEN    8        // Max length of LU name
  9.  
  10. #define VALIDATE_INT     1
  11. #define VALIDATE_APPC     2
  12.  
  13. #define INFINITE_TIMEOUT  "-1"         // Value used for infinite timeout
  14. #define INIT_TIMEOUT    5         // Initial value displayed in timeout box                    
  15. #define MAXTIMEOUTLEN    5         // Max digits in timeout
  16.  
  17. #ifdef WIN32
  18.  
  19. typedef struct _KeyEntry {
  20.   LPSTR lpParent;                       // Parent key
  21.   LPSTR lpName;                         // Data field name
  22.   int   iDataType;                      // Type of data    
  23.   LPSTR lpData;                // Data itself
  24.   int   iDataSize;            // Length of data, including nulls
  25. } KEYENTRY;
  26.  
  27. // The following variable defines the subkeys that are placed in the registry.
  28. // The first field gives the key under which to create the new subkey.  The
  29. // second field is the subkey name.  The third field is the data type.
  30. // The fourth field gives the data itself.  This should always be a string,
  31. // HOWEVER, if the third field isn't REG_SZ, some interpretation will go on,
  32. // as follows:
  33. //   If the third field is REG_MULTI_SZ, you should add an extra null character
  34. //   to the end of the string to simulate an array of strings.
  35. //   If the third field is REG_DWORD, you should enter the numeric value as
  36. //   a string in the fourth field, as in "345" if you want the data to be the
  37. //   number 345.
  38. // The fifth field is the length of the fourth field in bytes, INCLUDING nulls.
  39. // This field is set automatically for REG_DWORD data.
  40. KEYENTRY keyinfo[] = {
  41.   { "Linkage",    "OtherDependencies",    REG_MULTI_SZ, "SnaBase\0", 9 },
  42.   { "Parameters", "SNAServiceType",       REG_DWORD,    "5",         4 },
  43.   { "Parameters", "ConversationSecurity", REG_SZ,       "yes",       4 },
  44.   { "Parameters", "AlreadyVerified",      REG_SZ,       "yes",       4 },
  45.   { "Parameters", "Timeout",              REG_DWORD,    "",         4 },
  46.   { "Parameters", "Parameters",           REG_SZ,       "",       4 },
  47.   { "Parameters", "LocalLU",              REG_SZ,       "",         4 },
  48.   { "Parameters", "",                     REG_SZ,       "",          4 },
  49.   { "Parameters", "PathName",             REG_SZ,       "",          4 },
  50. };
  51.  
  52. // These numbers must correspond to the indices in keyinfo above!
  53. #define SNASRVTYPE 1
  54. #define CONVSEC    2
  55. #define ALREADYVER 3
  56. #define TIMEOUT    4
  57. #define PARAMETERS 5
  58. #define LUNAME     6
  59. #define USER       7      // Blank field for writing out users & passwords
  60. #define EXENAME    8
  61. #define NUMKEYS    6      // Last three keys only written out if needed
  62.  
  63. int  InstallServiceNT(HWND, LPSTR, LPSTR);
  64. int  CreateKeys(LPSTR, BOOL, LPSTR, int, int, int, LPSTR, LPSTR, LPSTR);
  65. INT  WriteKeyNT(LPSTR, KEYENTRY, BOOL);
  66.  
  67. #else
  68.  
  69. #define USHORT unsigned short
  70. #define INT    int
  71. #define SHORT  short
  72.  
  73. typedef struct _KeyEntry {
  74.   char *name;                        // Data field name
  75.   char *data;                 // Data itself
  76. } KEYENTRY;
  77.  
  78. // If you change the fields below, change the #defines too; they are used
  79. // as indices into the keyinfo structure to set the data fields, which are
  80. // initially all NULL.
  81.  
  82. KEYENTRY keyinfo[] = {
  83.   { "PathName",         NULL },
  84.   { "Parameters",         NULL },
  85.   { "Queued",             NULL },
  86.   { "Timeout",             NULL },
  87.   { "ConversationSecurity", NULL },
  88.   { "AlreadyVerified",      NULL },
  89.   { "LocalLU",            NULL },
  90.   { "",                     NULL },
  91. };
  92. #define PATHNAME    0
  93. #define PARAMETERS  1
  94. #define QUEUED      2
  95. #define TIMEOUT     3
  96. #define CONVSEC     4
  97. #define ALREADYVER  5
  98. #define LUNAME      6
  99. #define USER        7
  100. #define NUMKEYS     6        // Last keys only written out if necessary
  101.  
  102. int  InstallWindows(HWND, char *, char *, char *, char *, int, int, int, char *);
  103. INT  WriteKeyWindows(char *, char *, char *);
  104.  
  105. #endif //ifdef WIN32
  106.  
  107. extern BOOL CALLBACK MainDlgProc (HWND, UINT, WPARAM, LPARAM);
  108. extern BOOL CALLBACK UserDlgProc (HWND, UINT, WPARAM, LPARAM);
  109. BOOL ValidateField(HWND, USHORT);
  110. void InstallCallback(HWND, UINT, WNDPROC *, FARPROC);
  111. extern LRESULT CALLBACK ValidateFieldInt(HWND, WORD, WPARAM, LPARAM);
  112. extern LRESULT CALLBACK ValidateFieldAppc(HWND, WORD, WPARAM, LPARAM);
  113. extern LRESULT CALLBACK InfiniteWndProc(HWND, WORD, WPARAM, LPARAM);
  114. extern LRESULT CALLBACK FiniteWndProc(HWND, WORD, WPARAM, LPARAM);
  115. extern LRESULT CALLBACK ConvSecWndProc(HWND, WORD, WPARAM, LPARAM);
  116. extern LRESULT CALLBACK ServiceWndProc(HWND, WORD, WPARAM, LPARAM);
  117. void ParseCreateError(HWND, UINT);
  118. void DeleteListItem(INT);
  119. INT  ReadString(HWND, INT, char **, INT);
  120. void DisplayError(HWND, UINT);
  121. void DisplayInfo(HWND, UINT);
  122. void MakeValidLUName(LPTSTR name);
  123.