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.

117 lines
3.4 KiB

  1. /*---------------------------------------------**
  2. ** Copyright (c) 1998 Microsoft Corporation **
  3. ** All Rights reserved **
  4. ** **
  5. ** tsreg.c **
  6. ** **
  7. ** Entry point for TSREG, WinMain. **
  8. ** 07-01-98 a-clindh Created **
  9. **---------------------------------------------*/
  10. #include <windows.h>
  11. #include <commctrl.h>
  12. #include <TCHAR.H>
  13. #include "resource.h"
  14. #include "tsreg.h"
  15. HINSTANCE g_hInst;
  16. TCHAR g_lpszPath[MAX_PATH];
  17. ///////////////////////////////////////////////////////////////////////////////
  18. ///////////////////////////////////////////////////////////////////////////////
  19. int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
  20. LPSTR lpCmdLine, int nCmdShow)
  21. {
  22. TCHAR lpszRegPath[MAX_PATH];
  23. TCHAR lpszBuf[MAX_PATH];
  24. HKEY hKey;
  25. INITCOMMONCONTROLSEX cmctl;
  26. TCHAR AppBasePath[MAX_PATH];
  27. int nPathLen;
  28. /************************************************************************/
  29. // Grab the app's executable path.
  30. // Note that the end backslash remains.
  31. /************************************************************************/
  32. nPathLen = GetModuleFileName(hInstance,
  33. AppBasePath, MAX_PATH);
  34. if (nPathLen > 0) {
  35. // Strip the module name off the end to leave the executable
  36. // directory path, by looking for the last backslash.
  37. nPathLen--;
  38. while (nPathLen != 0) {
  39. if (AppBasePath[nPathLen] != _T('\\')) {
  40. nPathLen--;
  41. continue;
  42. }
  43. nPathLen++;
  44. break;
  45. }
  46. }
  47. //
  48. // Check that the path is not too long to contain the base path
  49. //
  50. if (nPathLen + MAXKEYSIZE > MAX_PATH) {
  51. TCHAR lpszText[MAXTEXTSIZE];
  52. LoadString(hInstance, IDS_PATH_TOO_LONG, lpszText, MAXTEXTSIZE);
  53. MB(lpszText);
  54. nPathLen = 0;
  55. }
  56. AppBasePath[nPathLen] = '\0';
  57. //
  58. // Append the name of the help file to the app path and
  59. // copy it to the global variable.
  60. //
  61. _tcscat(AppBasePath, TEXT("tsreg.hlp"));
  62. _tcscpy(g_lpszPath, AppBasePath);
  63. cmctl.dwICC = ICC_TAB_CLASSES | ICC_BAR_CLASSES;
  64. cmctl.dwSize = sizeof(INITCOMMONCONTROLSEX);
  65. InitCommonControlsEx(&cmctl);
  66. //
  67. // make sure Windows Terminal Server client is installed first.
  68. //
  69. LoadString (hInstance, IDS_PROFILE_PATH, lpszRegPath, sizeof (lpszRegPath));
  70. LoadString (hInstance, IDS_START_ERROR, lpszBuf, sizeof (lpszBuf));
  71. if (RegOpenKeyEx(HKEY_CURRENT_USER, lpszRegPath, 0,
  72. KEY_ALL_ACCESS, &hKey) != ERROR_SUCCESS) {
  73. MessageBox(NULL, lpszBuf,
  74. NULL,
  75. MB_OK | MB_ICONEXCLAMATION);
  76. RegCloseKey(hKey);
  77. return 1;
  78. }
  79. #ifdef USE_STRING_TABLE
  80. {
  81. int i;
  82. //
  83. // load string table values into g_KeyInfo data structure
  84. //
  85. for (i = KEYSTART; i < (KEYEND + 1); i++) {
  86. LoadString (hInstance, i,
  87. g_KeyInfo[i - KEYSTART].Key,
  88. sizeof (g_KeyInfo[i - KEYSTART].Key));
  89. }
  90. }
  91. #endif
  92. g_hInst = hInstance;
  93. CreatePropertySheet(NULL);
  94. return 0;
  95. }
  96. // end of file
  97. ///////////////////////////////////////////////////////////////////////////////