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.

107 lines
1.9 KiB

  1. //+--------------------------------------------------------------------------
  2. //
  3. // Copyright (c) 1997-1999 Microsoft Corporation
  4. //
  5. // File: test.cpp
  6. //
  7. // Contents: Test TS4 license server database upgrade to TS5
  8. //
  9. // History:
  10. //
  11. //---------------------------------------------------------------------------
  12. #include <windows.h>
  13. #include <shellapi.h>
  14. #include <tchar.h>
  15. #include <stdio.h>
  16. #include <stdlib.h>
  17. #include "upg.h"
  18. void
  19. PrintUsage(
  20. LPCTSTR pszExeName
  21. )
  22. /*++
  23. ++*/
  24. {
  25. _tprintf(
  26. _TEXT("Usage : %s -D <Directory> -F <Db File name>\n"),
  27. pszExeName
  28. );
  29. exit(0);
  30. }
  31. //--------------------------------------------------------------------------
  32. int
  33. main(
  34. int argc,
  35. char* argv[]
  36. )
  37. /*++
  38. ++*/
  39. {
  40. int dwArgc;
  41. LPTSTR *lpszArgv;
  42. LPTSTR pszPath=NULL;
  43. LPTSTR pszFile=NULL;
  44. #ifdef UNICODE
  45. lpszArgv = CommandLineToArgvW(GetCommandLineW(), &(dwArgc) );
  46. #else
  47. dwArgc = (DWORD) argc;
  48. lpszArgv = argv;
  49. #endif
  50. if(argc < 2)
  51. {
  52. PrintUsage(lpszArgv[0]);
  53. }
  54. for(int i=1; i < dwArgc; i+=2)
  55. {
  56. if(i+1 >= dwArgc || lpszArgv[i][0] != _TEXT('-') || lpszArgv[i+1][0] ==_TEXT('-'))
  57. {
  58. // missing argument.
  59. PrintUsage(lpszArgv[0]);
  60. }
  61. switch(lpszArgv[i][1])
  62. {
  63. case _TEXT('D') :
  64. case _TEXT('d') :
  65. pszPath = lpszArgv[i+1];
  66. break;
  67. case _TEXT('F') :
  68. case _TEXT('f') :
  69. pszFile = lpszArgv[i+1];
  70. break;
  71. default:
  72. PrintUsage(lpszArgv[0]);
  73. }
  74. }
  75. if(pszPath == NULL)
  76. {
  77. PrintUsage(lpszArgv[0]);
  78. }
  79. DWORD dwStatus;
  80. dwStatus = UpgradeNT4Database(
  81. 0,
  82. pszPath,
  83. pszFile
  84. );
  85. return 0;
  86. }