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.

177 lines
3.8 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. All rights reserved.
  4. Module Name:
  5. Migmain.c
  6. Abstract:
  7. Routines to migrate Win95 to NT
  8. Author:
  9. Keisuke Tsuchida (KeisukeT) 10-Oct-2000
  10. Revision History:
  11. --*/
  12. #include "precomp.h"
  13. #pragma hdrstop
  14. #include <devguid.h>
  15. #include "msg.h"
  16. //
  17. // Global
  18. //
  19. HINSTANCE g_hInst = (HINSTANCE)NULL;
  20. BOOL
  21. DllEntryPoint(
  22. IN HINSTANCE hInst,
  23. IN DWORD dwReason,
  24. IN LPVOID lpRes
  25. )
  26. /*++
  27. Routine Description:
  28. Dll entry point.
  29. Arguments:
  30. Return Value:
  31. --*/
  32. {
  33. UNREFERENCED_PARAMETER(lpRes);
  34. switch( dwReason ){
  35. case DLL_PROCESS_ATTACH:
  36. g_hInst = hInst;
  37. SetupOpenLog(FALSE);
  38. break;
  39. case DLL_PROCESS_DETACH:
  40. g_hInst = (HINSTANCE)NULL;
  41. SetupCloseLog();
  42. break;
  43. default:
  44. return FALSE;
  45. }
  46. return TRUE;
  47. }
  48. LONG
  49. QueryVersion(
  50. OUT LPCSTR *pszProductID,
  51. OUT LPUINT plDllVersion,
  52. OUT LPINT *pCodePageArray OPTIONAL,
  53. OUT LPCSTR *ExeNamesBuf OPTIONAL,
  54. OUT PVENDORINFO *pVendorInfo
  55. )
  56. {
  57. BOOL bFail = TRUE;
  58. LPSTR pszLocalProductID;
  59. VENDORINFO VendorInfo;
  60. DWORD dwRet, dwNeeded, dwReturned, dwLangId;
  61. if ( !(pszLocalProductID = GetStringFromRcFileA(IDS_PRODUCTID)) )
  62. goto Done;
  63. ZeroMemory(&VendorInfo, sizeof(VendorInfo));
  64. dwLangId = MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT);
  65. FormatMessageA(FORMAT_MESSAGE_FROM_HMODULE
  66. | FORMAT_MESSAGE_ARGUMENT_ARRAY,
  67. (LPVOID)g_hInst,
  68. MSG_VI_COMPANY_NAME,
  69. dwLangId,
  70. VendorInfo.CompanyName,
  71. sizeof(VendorInfo.CompanyName),
  72. 0);
  73. FormatMessageA(FORMAT_MESSAGE_FROM_HMODULE
  74. | FORMAT_MESSAGE_ARGUMENT_ARRAY,
  75. (LPVOID)g_hInst,
  76. MSG_VI_SUPPORT_NUMBER,
  77. dwLangId,
  78. VendorInfo.SupportNumber,
  79. sizeof(VendorInfo.SupportNumber),
  80. 0);
  81. FormatMessageA(FORMAT_MESSAGE_FROM_HMODULE
  82. | FORMAT_MESSAGE_ARGUMENT_ARRAY,
  83. (LPVOID)g_hInst,
  84. MSG_VI_SUPPORT_URL,
  85. dwLangId,
  86. VendorInfo.SupportUrl,
  87. sizeof(VendorInfo.SupportUrl),
  88. 0);
  89. FormatMessageA(FORMAT_MESSAGE_FROM_HMODULE
  90. | FORMAT_MESSAGE_ARGUMENT_ARRAY,
  91. (LPVOID)g_hInst,
  92. MSG_VI_INSTRUCTIONS,
  93. dwLangId,
  94. VendorInfo.InstructionsToUser,
  95. sizeof(VendorInfo.InstructionsToUser),
  96. 0);
  97. *pszProductID = pszLocalProductID;
  98. *plDllVersion = 1;
  99. *pCodePageArray = NULL;
  100. *ExeNamesBuf = NULL;
  101. *pVendorInfo = &VendorInfo;
  102. /********
  103. //
  104. // Call this DLL only if there are some printers or printer drivers
  105. // installed
  106. //
  107. if ( EnumPrinterDriversA(NULL,
  108. NULL,
  109. 3,
  110. NULL,
  111. 0,
  112. &dwNeeded,
  113. &dwReturned) &&
  114. EnumPrintersA(PRINTER_ENUM_LOCAL,
  115. NULL,
  116. 2,
  117. NULL,
  118. 0,
  119. &dwNeeded,
  120. &dwReturned) ) {
  121. return ERROR_NOT_INSTALLED;
  122. }
  123. ********/
  124. bFail = FALSE;
  125. Done:
  126. if ( bFail ) {
  127. if ( dwRet = GetLastError() )
  128. return dwRet;
  129. return STG_E_UNKNOWN;
  130. }
  131. return ERROR_SUCCESS;
  132. }
  133. P_QUERY_VERSION pQueryVersion = QueryVersion;