Subversion Repositories userdetect2

Rev

Rev 69 | Go to most recent revision | Blame | Last modification | View Log | RSS feed

  1. library UserSID;
  2.  
  3. uses
  4.   Windows,
  5.   SysUtils,
  6.   Classes,
  7.   SPgetsid,
  8.   UD2_PluginIntf in '..\UD2_PluginIntf.pas',
  9.   UD2_PluginUtils in '..\UD2_PluginUtils.pas';
  10.  
  11. {$R *.res}
  12.  
  13. const
  14.   PLUGIN_GUID: TGUID = '{96374FFC-0A55-46B4-826B-CFD702FB24A2}';
  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 := GetCurrentUserSid;
  26.   result := UD2_WritePascalStringToPointerW(lpIdentifier, cchSize, stIdentifier);
  27. end;
  28.  
  29. function PluginNameW(lpPluginName: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
  30. var
  31.   stPluginName: WideString;
  32.   primaryLangID: Byte;
  33. begin
  34.   primaryLangID := wLangID and $00FF;
  35.   if primaryLangID = LANG_GERMAN then
  36.     stPluginName := 'SID des Benutzers'
  37.   else
  38.     stPluginName := 'User Security Identifier';
  39.   result := UD2_WritePascalStringToPointerW(lpPluginName, cchSize, stPluginName);
  40. end;
  41.  
  42. function PluginVendorW(lpPluginVendor: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
  43. begin
  44.   result := UD2_WritePascalStringToPointerW(lpPluginVendor, cchSize, 'ViaThinkSoft');
  45. end;
  46.  
  47. function PluginVersionW(lpPluginVersion: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
  48. begin
  49.   result := UD2_WritePascalStringToPointerW(lpPluginVersion, cchSize, '1.0');
  50. end;
  51.  
  52. function IdentificationMethodNameW(lpIdentificationMethodName: LPWSTR; cchSize: DWORD): UD2_STATUS; cdecl;
  53. var
  54.   stIdentificationMethodName: WideString;
  55. begin
  56.   stIdentificationMethodName := 'SID';
  57.   result := UD2_WritePascalStringToPointerW(lpIdentificationMethodName, cchSize, stIdentificationMethodName);
  58. end;
  59.  
  60. function CheckLicense(lpReserved: LPVOID): UD2_STATUS; cdecl;
  61. begin
  62.   result := UD2_STATUS_OK_LICENSED;
  63. end;
  64.  
  65. function DescribeOwnStatusCodeW(lpErrorDescription: LPWSTR; cchSize: DWORD; statusCode: UD2_STATUS; wLangID: LANGID): BOOL; cdecl;
  66. begin
  67.   // This function does not use non-generic status codes
  68.   result := FALSE;
  69. end;
  70.  
  71. exports
  72.   PluginInterfaceID         name mnPluginInterfaceID,
  73.   PluginIdentifier          name mnPluginIdentifier,
  74.   PluginNameW               name mnPluginNameW,
  75.   PluginVendorW             name mnPluginVendorW,
  76.   PluginVersionW            name mnPluginVersionW,
  77.   IdentificationMethodNameW name mnIdentificationMethodNameW,
  78.   IdentificationStringW     name mnIdentificationStringW,
  79.   CheckLicense              name mnCheckLicense,
  80.   DescribeOwnStatusCodeW    name mnDescribeOwnStatusCodeW;
  81.  
  82. end.
  83.