SetSecurityInfo on Winstation Object - Invalid Access To Memory Location

From: M (mark_at_wizbang.org.uk)
Date: 03/16/05

  • Next message: hafezrabbani_at_gmail.com: "Re: DBgrid and Mouse Wheel"
    Date: 16 Mar 2005 04:48:28 -0800
    
    

    Hi All,

    I'm trying to set a new DACL (using D5) on both the Winstation and
    Desktop objects during Winlogon using the following code

    <code>

    procedure set_winstation_dacl(hToken : cardinal);
    var s : string;
        d : string;
        dt : hdesk;
        mydacl : pacl;
        sd : psecurity_descriptor
        lo_sid : string;
    begin
       .
       .
       .
       .
       d := 'D:(A;NP;LCWP;;;'+s+') blah blah blah';

       dt := openwindowstation('WinSta0',false,GENERIC_ALL);

       fillchar(mydacl,sizeof(pacl),0);
       fillchar(sd.a,sizeof(psecurity_descriptor),0);

    convertstringsecuritydescriptortosecuritydescriptor(pchar(d),SDDL_REVISION_1,sd,nil);

       if
    setsecurityinfo(dt,SE_WINDOW_OBJECT,DACL_SECURITY_INFORMATION,nil,nil,sd.dacl,nil)<>ERROR_SUCCESS
    then
          showmessage('Winstation - ' + syserrormessage(getlasterror))
       else
          showmessage('Winstation ok');

       .
       .
       .
       .
    end;

    </code>

    but essentially always come up with the error - Invalid Access To
    Memory Location. I've previously read stuff about DWORD alignment
    using the SetSecurityInfo API and have {$A+} set as a directive in the
    code, however, makes no difference :-(

    In the above hToken is obtained using the code

    logonuser('a','b','c',LOGON32_LOGON_INTERACTIVE,LOGON32_PROVIDER_DEFAULT,th)

    and passing th (declared as cardinal) to the above procedure.
    Can anyone assist with this conundrum please ?

    TIA

    Mark


  • Next message: hafezrabbani_at_gmail.com: "Re: DBgrid and Mouse Wheel"

    Relevant Pages

    • Re: Calculate the string statement
      ... verkn:(vkn:char; ... funkt:(fkt:string; ... var fkt,dfkt: p; ... var fehler: boolean; ...
      (comp.lang.pascal.borland)
    • Two new tests for MM B&V
      ... var RunningThreads: Integer; ... class function TStringThreadTest.GetBenchmarkDescription: string; ... function CheckPattern(const Dest: Pointer; const Size: Integer; const ...
      (borland.public.delphi.language.basm)
    • server-side JavaScript: Prototypes of built-in classes, objects and functins
      ... Session object (disk-based session variables for data persistence ... File class (manipulation of files on server, ie. open, close, read, ... //Methods Cgi.queryCgi.postCgi.anyby default return an empty string if requested var not found ...
      (comp.lang.javascript)
    • Re: [PHP] Image Generation
      ... the text, font, colour, maximum frame size (ie the width and height it ... var $xoffset, $yoffset, $margin; ... a string or array of strings. ... a float or an array of floats - which size to display the related text at. ...
      (php.general)
    • Ajax -> javascript edit box display problems - please help
      ... Public Function GetUsernameList(ByVal testParam As String) As String ... getItem: function{ ... getLength: function{ ... var v = this.getValue); ...
      (comp.lang.javascript)