Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

AddIPAddress via LogonUser

Empfohlene Antworten

Veröffentlicht

Hallo Leutz,

nun habe ich mal wieder ein Problem und hoffe sehr das mir die Profis hier eine befriedigende Antwort gegen können.

Ich muss in meinem Projekt eine IPAdresse dem NetzwerkAdapter zuweisen. Das funktioniert auch. Das Problem tritt auf wenn man das Programm mit einen StandardUser ohne Adminrechten ausführt. In der Anwendung wird aber einen UserContextSwitch mit LogonUser durchgeführt der diese Berechtigung besitzt. Führt man die Anwendung dann aus, bekomme ich den ErrorCode 6 (ERROR_INVALID_HANDLE) zurück geliefert.



[DllImport("iphlpapi.dll", SetLastError = true)]
private static extern UInt32 AddIPAddress(UInt32 Address, UInt32 IpMaskint, int IfIndex, out IntPtr NTEContext, out IntPtr NTEInstance);

[/PHP]

[PHP]

//...
WindowsImpersonationContext impContext = null;

impContext = UserImpersonation.ImpersonateUser(
strDomian,
strServiceAccount_UserID,
strServiceAccount_Pass,
LogonType.LOGON32_LOGON_INTERACTIVE,
LogonProvider.LOGON32_PROVIDER_DEFAULT);

//...

Was aber funktioniert, wenn man das Programm mit runasuser mit genau diesen AdminUser ausführt den ich auch im Programm verwende.

Warum bekomme ich aber innerhalb meiner Anwendung keinen korreken UserSwitch hin? Was mache ich falsch. Habe schon Google und MSDN befragt. Aber hier finde ich keine befreidigende Aussage. Nur das es irgendwie nicht funktionieren soll. :confused:

MSDN also states that..

"Note Group policies, enterprise policies, and other restrictions on the network may prevent these functions from completing successfully. Ensure that the application has the necessary network permissions before attempting to use these functions."

Danke schon mal für Eure Hilfe.

Oh Ich vergass zu erwähnen, das ich VS 2010 .net 4.0 C# unter WINXP SP3 verwende.

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.