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.

91 lines
2.8 KiB

  1. //****************************************************************************
  2. //
  3. // Module: ISIGNUP.EXE
  4. // File: custom.c
  5. // Content: This file contains all the functions that handle importing
  6. // connection information.
  7. // History:
  8. // Sat 10-Mar-1996 23:50:40 -by- Mark MacLin [mmaclin]
  9. // some of this code started its life in ixport.c in RNAUI.DLL
  10. // my thanks to viroont
  11. //
  12. // Copyright (c) Microsoft Corporation 1991-1996
  13. //
  14. //****************************************************************************
  15. #include "isignup.h"
  16. #pragma data_seg(".rdata")
  17. static const TCHAR cszCustomSection[] = TEXT("Custom");
  18. static const TCHAR cszFileName[] = TEXT("Custom_File");
  19. static const TCHAR cszRun[] = TEXT("Run");
  20. static const TCHAR cszArgument[] = TEXT("Argument");
  21. static const TCHAR cszCustomFileSection[] = TEXT("Custom_File");
  22. static const TCHAR cszNull[] = TEXT("");
  23. #pragma data_seg()
  24. //****************************************************************************
  25. // DWORD NEAR PASCAL ImportCustomFile(LPSTR szImportFile)
  26. //
  27. // This function imports the custom file
  28. //
  29. // History:
  30. // Mon 21-Mar-1996 12:40:00 -by- Mark MacLin [mmaclin]
  31. // Created.
  32. //****************************************************************************
  33. DWORD ImportCustomFile(LPCTSTR lpszImportFile)
  34. {
  35. TCHAR szFile[_MAX_PATH];
  36. TCHAR szTemp[_MAX_PATH];
  37. // If a custom file name does not exist, do nothing
  38. //
  39. if (GetPrivateProfileString(cszCustomSection,
  40. cszFileName,
  41. cszNull,
  42. szTemp,
  43. _MAX_PATH,
  44. lpszImportFile) == 0)
  45. {
  46. return ERROR_SUCCESS;
  47. };
  48. GetWindowsDirectory(szFile, _MAX_PATH);
  49. if (*CharPrev(szFile, szFile + lstrlen(szFile)) != '\\')
  50. {
  51. lstrcat(szFile, TEXT("\\"));
  52. }
  53. lstrcat(szFile, szTemp);
  54. return (ImportFile(lpszImportFile, cszCustomFileSection, szFile));
  55. }
  56. DWORD ImportCustomInfo(
  57. LPCTSTR lpszImportFile,
  58. LPTSTR lpszExecutable,
  59. DWORD cbExecutable,
  60. LPTSTR lpszArgument,
  61. DWORD cbArgument)
  62. {
  63. GetPrivateProfileString(cszCustomSection,
  64. cszRun,
  65. cszNull,
  66. lpszExecutable,
  67. (int)cbExecutable,
  68. lpszImportFile);
  69. GetPrivateProfileString(cszCustomSection,
  70. cszArgument,
  71. cszNull,
  72. lpszArgument,
  73. (int)cbArgument,
  74. lpszImportFile);
  75. return ERROR_SUCCESS;
  76. }