Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Win32/Win64 API (native code) (https://www.delphipraxis.net/17-win32-win64-api-native-code/)
-   -   Delphi logonuser-schwierigkeiten (https://www.delphipraxis.net/11133-logonuser-schwierigkeiten.html)

Illuminator-23-5 31. Okt 2003 14:59


logonuser-schwierigkeiten
 
ich spiel grad mit logonuser ein bisschen rum, doch ich komm nicht recht weit.
wenn ich es aufrufe, kommt immer der Fehler 87 = ungültige Parameter
hier der funktionsaufruf:
Delphi-Quellcode:
  logonUser(PChar(edit1.Text), PChar(Edit3.Text), PChar(edit2.Text),
    0, LOGON32_LOGON_NETWORK, h);
  if h = 0 then begin
    ShowMessage(IntToStr(GetLastError) + ' - error');
  end
  else
    ShowMessage('got: ' + IntToStr(h));
in den Edits befinen sich die richtigen daten(benutzername, passwort und domain stimmen)

woran könnts liegen, dasses nicht klappt?

Tpercon 31. Okt 2003 15:15

Re: logonuser-schwierigkeiten
 
Tausch mal den 4. und 5. Parameter. Wie siehts dann aus?

Illuminator-23-5 31. Okt 2003 18:45

Re: logonuser-schwierigkeiten
 
beim fünften hab ich schon alles probiert, aber beim 4. weiß ich nicht!

Tpercon 1. Nov 2003 12:33

Re: logonuser-schwierigkeiten
 
Zitat:

BOOL LogonUser(

LPTSTR lpszUsername, // string that specifies the user name
LPTSTR lpszDomain, // string that specifies the domain or server
LPTSTR lpszPassword, // string that specifies the password
DWORD dwLogonType, // specifies the type of logon operation
DWORD dwLogonProvider, // specifies the logon provider
PHANDLE phToken // pointer to variable to receive token handle
);
Zitat:

dwLogonType

Specifies the type of logon operation to perform. The following logon types are defined:

Value Meaning
LOGON32_LOGON_BATCH This logon type is intended for batch servers, where processes may be executing on behalf of a user without their direct intervention; or for higher performance servers that process many clear-text authentication attempts at a time, such as mail or web servers. LogonUser does not cache credentials for this logon type.
LOGON32_LOGON_INTERACTIVE This logon type is intended for users who will be interactively using the machine, such as a user being logged on by a terminal server, remote shell, or similar process. This logon type has the additional expense of caching logon information for disconnected operation, and is therefore inappropriate for some client/server applications, such as a mail server.
LOGON32_LOGON_SERVICE Indicates a service-type logon. The account provided must have the service privilege enabled.
LOGON32_LOGON_NETWORK This logon type is intended for high performance servers to authenticate clear text passwords. LogonUser does not cache credentials for this logon type. This is the fastest logon path, but there are two limitations. First, the function returns an impersonation token, not a primary token. You cannot use this token directly in the CreateProcessAsUser function. However, you can call the DuplicateTokenEx function to convert the token to a primary token, and then use it in CreateProcessAsUser. Second, if you convert the token to a primary token and use it in CreateProcessAsUser to start a process, the new process will not be able to access other network resources, such as remote servers or printers, through the redirector.


dwLogonProvider

Specifies the logon provider. The following logon providers are defined:

Value Meaning
LOGON32_PROVIDER_DEFAULT Use the standard logon provider. This is the recommended value for dwLogonProvider. It gives an application the maximum upward compatibility with future releases of Windows NT.
Daher -> tausch den 4. und 5. Parameter bei dir. Geht'S dann?

Illuminator-23-5 6. Nov 2003 19:07

Re: logonuser-schwierigkeiten
 
*fast in vergessenheit geraten:( :oops: *

nee, da gehts leider auch nicht, da bekomm ich immer den wert 1936 zurück, habe aber auch dafür keinen Fehler gefunden!

Motzi 7. Nov 2003 10:43

Re: logonuser-schwierigkeiten
 
Zitat:

Zitat von MSDN
The process calling LogonUser requires the SE_TCB_NAME privilege. If the calling process does not have this privilege, LogonUser fails and GetLastError returns ERROR_PRIVILEGE_NOT_HELD.

Du benötigst das TCB-Privilege und das besitzt du normalerweise nur wenn dein Prog als Service läuft..!

ChromStahl 13. Dez 2004 12:04

Re: logonuser-schwierigkeiten
 
Du hast den dwLogonProvider vergessen.


Alle Zeitangaben in WEZ +1. Es ist jetzt 13:11 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz