Subversion Repositories userdetect2

Rev

Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1. library WinVersion;
  2.  
  3. uses
  4.   Windows,
  5.   SysUtils,
  6.   Classes,
  7.   UD2_PluginIntf in '..\UD2_PluginIntf.pas',
  8.   UD2_PluginUtils in '..\UD2_PluginUtils.pas',
  9.   UD2_PluginStatus in '..\UD2_PluginStatus.pas';
  10.  
  11. {$R *.res}
  12.  
  13. const
  14.   PLUGIN_GUID: TGUID = '{07A0A0B0-4076-4A76-8992-57C6965269A0}';
  15.  
  16. function PluginIdentifier: TGUID; cdecl;
  17. begin
  18.   result := PLUGIN_GUID;
  19. end;
  20.  
  21. function IdentificationStringW(lpIdentifier: LPWSTR; cchSize: DWORD): UD2_STATUS; cdecl;
  22. var
  23.   stIdentifier: WideString;
  24. begin
  25.   stIdentifier := IntToStr(Win32MajorVersion) + '.' +
  26.                   IntToStr(Win32MinorVersion) + '.' +
  27.                   IntToStr(Win32BuildNumber);
  28.   result := UD2_WritePascalStringToPointerW(lpIdentifier, cchSize, stIdentifier);
  29. end;
  30.  
  31. function PluginNameW(lpPluginName: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
  32. var
  33.   stPluginName: WideString;
  34.   primaryLangID: Byte;
  35. begin
  36.   primaryLangID := wLangID and $00FF;
  37.   if primaryLangID = LANG_GERMAN then
  38.     stPluginName := 'Windows-Version'
  39.   else
  40.     stPluginName := 'Windows version';
  41.   result := UD2_WritePascalStringToPointerW(lpPluginName, cchSize, stPluginName);
  42. end;
  43.  
  44. function PluginVendorW(lpPluginVendor: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
  45. begin
  46.   result := UD2_WritePascalStringToPointerW(lpPluginVendor, cchSize, 'ViaThinkSoft');
  47. end;
  48.  
  49. function PluginVersionW(lpPluginVersion: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
  50. begin
  51.   result := UD2_WritePascalStringToPointerW(lpPluginVersion, cchSize, '1.0');
  52. end;
  53.  
  54. function IdentificationMethodNameW(lpIdentificationMethodName: LPWSTR; cchSize: DWORD): UD2_STATUS; cdecl;
  55. var
  56.   stIdentificationMethodName: WideString;
  57. begin
  58.   stIdentificationMethodName := 'WinVersion';
  59.   result := UD2_WritePascalStringToPointerW(lpIdentificationMethodName, cchSize, stIdentificationMethodName);
  60. end;
  61.  
  62. function CheckLicense(lpReserved: LPVOID): UD2_STATUS; cdecl;
  63. begin
  64.   result := UD2_STATUS_OK_LICENSED;
  65. end;
  66.  
  67. function DescribeOwnStatusCodeW(lpErrorDescription: LPWSTR; cchSize: DWORD; statusCode: UD2_STATUS; wLangID: LANGID): BOOL; cdecl;
  68. begin
  69.   // This function does not use non-generic status codes
  70.   result := FALSE;
  71. end;
  72.  
  73. exports
  74.   PluginInterfaceID         name mnPluginInterfaceID,
  75.   PluginIdentifier          name mnPluginIdentifier,
  76.   PluginNameW               name mnPluginNameW,
  77.   PluginVendorW             name mnPluginVendorW,
  78.   PluginVersionW            name mnPluginVersionW,
  79.   IdentificationMethodNameW name mnIdentificationMethodNameW,
  80.   IdentificationStringW     name mnIdentificationStringW,
  81.   CheckLicense              name mnCheckLicense,
  82.   DescribeOwnStatusCodeW    name mnDescribeOwnStatusCodeW;
  83.  
  84. end.
  85.