Subversion Repositories userdetect2

Rev

Rev 73 | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1. library AccountSID;
  2.  
  3. uses
  4.   Windows,
  5.   SysUtils,
  6.   Classes,
  7.   MiscUtils,
  8.   SPgetsid,
  9.   UD2_PluginIntf in '..\UD2_PluginIntf.pas',
  10.   UD2_PluginUtils in '..\UD2_PluginUtils.pas',
  11.   UD2_PluginStatus in '..\UD2_PluginStatus.pas';
  12.  
  13. {$R *.res}
  14.  
  15. const
  16.   PLUGIN_GUID: TGUID = '{96374FFC-0A55-46B4-826B-CFD702FB24A2}';
  17.  
  18. function PluginIdentifier: TGUID; cdecl;
  19. begin
  20.   result := PLUGIN_GUID;
  21. end;
  22.  
  23. function IdentificationStringW(lpIdentifier: LPWSTR; cchSize: DWORD): UD2_STATUS; cdecl;
  24. var
  25.   stIdentifier: WideString;
  26. begin
  27.   try
  28.     if GetPlatformID = VER_PLATFORM_WIN32_WINDOWS then
  29.     begin
  30.       result := UD2_STATUS_NOTAVAIL_OS_NOT_SUPPORTED;
  31.       Exit;
  32.     end;
  33.  
  34.     stIdentifier := GetCurrentUserSid;
  35.     result := UD2_WritePascalStringToPointerW(lpIdentifier, cchSize, stIdentifier);
  36.   except
  37.     on E: Exception do result := UD2_STATUS_HandleException(E);
  38.   end;
  39. end;
  40.  
  41. function PluginNameW(lpPluginName: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
  42. var
  43.   stPluginName: WideString;
  44.   primaryLangID: Byte;
  45. begin
  46.   primaryLangID := wLangID and $00FF;
  47.   if primaryLangID = LANG_GERMAN then
  48.     stPluginName := 'SID des Benutzerkontos'
  49.   else
  50.     stPluginName := 'Account Security Identifier';
  51.   result := UD2_WritePascalStringToPointerW(lpPluginName, cchSize, stPluginName);
  52. end;
  53.  
  54. function PluginVendorW(lpPluginVendor: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
  55. begin
  56.   result := UD2_WritePascalStringToPointerW(lpPluginVendor, cchSize, 'ViaThinkSoft');
  57. end;
  58.  
  59. function PluginVersionW(lpPluginVersion: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
  60. begin
  61.   result := UD2_WritePascalStringToPointerW(lpPluginVersion, cchSize, '1.0');
  62. end;
  63.  
  64. function IdentificationMethodNameW(lpIdentificationMethodName: LPWSTR; cchSize: DWORD): UD2_STATUS; cdecl;
  65. var
  66.   stIdentificationMethodName: WideString;
  67. begin
  68.   stIdentificationMethodName := 'AccountSID';
  69.   result := UD2_WritePascalStringToPointerW(lpIdentificationMethodName, cchSize, stIdentificationMethodName);
  70. end;
  71.  
  72. function CheckLicense(lpReserved: LPVOID): UD2_STATUS; cdecl;
  73. begin
  74.   result := UD2_STATUS_OK_LICENSED;
  75. end;
  76.  
  77. function DescribeOwnStatusCodeW(lpErrorDescription: LPWSTR; cchSize: DWORD; statusCode: UD2_STATUS; wLangID: LANGID): BOOL; cdecl;
  78. begin
  79.   // This function does not use non-generic status codes
  80.   result := FALSE;
  81. end;
  82.  
  83. exports
  84.   PluginInterfaceID         name mnPluginInterfaceID,
  85.   PluginIdentifier          name mnPluginIdentifier,
  86.   PluginNameW               name mnPluginNameW,
  87.   PluginVendorW             name mnPluginVendorW,
  88.   PluginVersionW            name mnPluginVersionW,
  89.   IdentificationMethodNameW name mnIdentificationMethodNameW,
  90.   IdentificationStringW     name mnIdentificationStringW,
  91.   CheckLicense              name mnCheckLicense,
  92.   DescribeOwnStatusCodeW    name mnDescribeOwnStatusCodeW;
  93.  
  94. end.
  95.