Ich versuche gerade die Funktion
NetRemoteComputerSupports zu benutzen. Bishert habe ich das so:
Delphi-Quellcode:
const
SUPPORTS_REMOTE_ADMIN_PROTOCOL = $00000002;
SUPPORTS_RPC = $00000004;
SUPPORTS_SAM_PROTOCOL = $00000008;
SUPPORTS_UNICODE = $00000010;
SUPPORTS_LOCAL = $00000020;
SUPPORTS_ANY = $FFFFFFFF;
NERR_Success = 0;
function NetRemoteComputerSupports(UNCServername: PWideChar; OptionswWanted:
DWORD; var OptionSupported: DWORD): NET_API_STATUS; external 'netapi32.dll'
Name 'NetRemoteComputerSupports';
function NetApiBufferFree(Buffer: Pointer): NET_API_STATUS; stdcall;
external 'netapi32.dll' Name 'NetApiBufferFree';
implementation
{$R *.dfm}
procedure TForm1.btnGetClick(Sender: TObject);
var
OptionsSupported: DWORD;
ret: NET_API_STATUS;
begin
ret := NetRemoteComputerSupports(PWideChar(WideString(edtComputer.Text)),
SUPPORTS_ANY, OptionsSupported);
if ret = NERR_Success then
begin
CheckBox1.Checked := (OptionsSupported and SUPPORTS_REMOTE_ADMIN_PROTOCOL)
= 0;
end;
end;
Aber
ret ist 123, was auch immer das bedeuted, und ich bekomme dann eine AccessViolation. Ich sehe aber meinen Fehler nicht.