Einzelnen Beitrag anzeigen

Gruber_Hans_12345

Registriert seit: 14. Aug 2004
1.426 Beiträge
 
Delphi 2007 Professional
 
#1

WTSQuerySessionInformationA falscher Parameter

  Alt 25. Okt 2022, 11:03
Stehe gerade am Schlauch, mir liefert der Aufruf false zurück und der RaiseLastOsError sagt falscher Paramter.

Delphi-Quellcode:
    
type
TWTSQuerySessionInformationA = function(hServer: THandle; SessionId: DWORD; WTSInfoClass: _WTS_INFO_CLASS; var ppBuffer: Pointer; var pBytesReturned: DWORD): BOOL; stdcall;

const WTS_CURRENT_SESSION = DWORD(-1);
var ppBuffer: Pointer;
pBytesReturned: DWORD
begin
    _TWTSQuerySessionInformationA := GetProcAddress(LoadLibrary(PAnsiChar('wtsapi32.dll')), PAnsiChar('WTSQuerySessionInformationA'));
    Result := TWTSQuerySessionInformationA(_TWTSQuerySessionInformationA)(WTS_CURRENT_SERVER_HANDLE, WTS_CURRENT_SESSION, WTSClientName, ppBuffer, pBytesReturned);
    try
        if not Result then
            RaiseLastOSError;
    except
    end;
end;
Ich vermute das ich irgendwo einen Nebeneffekt bekomme, da wenn ich es in einem 0815 testprogramm den selben code starte er durchläuft
Was könnte mein Programm da "verbrechen" das ich dann so einen Fehler bekomme? - wer ne idee?
Gruss Hans

2B or not 2B, that is FF
  Mit Zitat antworten Zitat