Subversion Repositories recyclebinunit

Rev

Rev 75 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 75 Rev 79
Line 159... Line 159...
159
  UniqueString(strSID);
159
  UniqueString(strSID);
160
  _RtlFreeUnicodeString(pus);
160
  _RtlFreeUnicodeString(pus);
161
  result := true;
161
  result := true;
162
end;
162
end;
163
 
163
 
164
// http://www.delphipraxis.net/post471470.html
164
// Source: http://www.delphipraxis.net/post471470.html
165
// Changed
165
// Modified
166
function GetMySID(): string;
166
function GetMySID(): string;
167
var
167
var
168
  SID: PSID;
168
  SID: PSID;
169
  strSID: PAnsiChar;
169
  strSID: PAnsiChar;
170
  err: DWORD;
170
  err: DWORD;
171
begin
171
begin
172
  SID := nil;
172
  SID := nil;
173
 
173
 
174
  err := _getAccountSid('', _getLoginNameW(), SID);
174
  err := _getAccountSid('', _getLoginNameW(), SID);
-
 
175
  try
175
  if err > 0 then
176
    if err > 0 then
176
  begin
177
    begin
177
    EAPICallError.Create('_getAccountSid:' + SysErrorMessage(err));
178
      EAPICallError.Create('_getAccountSid:' + SysErrorMessage(err));
178
    Exit;
179
      Exit;
179
  end;
180
    end;
Line 186... Line 187...
186
 
187
 
187
  if not _NT_SidToString(SID, result) then
188
    if not _NT_SidToString(SID, result) then
188
  begin
189
    begin
189
    EAPICallError.Create('_NT_SidToString'); // TODO: RaiseLastOsError???
190
      EAPICallError.Create('_NT_SidToString'); // TODO: RaiseLastOsError???
190
  end;
191
    end;
-
 
192
  finally
-
 
193
    if Assigned(SID) then FreeMemory(SID);
-
 
194
  end;
191
end;
195
end;
192
 
196
 
193
end.
197
end.