Questions tagged [advapi32]

Anything related to MS Windows Advanced Services API for 32bit systems (part of Windows API), residing in the `advapi32.dll` library. This library provides functions to access Windows registry, to restart the system, to create Windows services and to manage user accounts.

Anything related to MS Windows Advanced Services API for 32bit systems (part of Windows API), residing in the advapi32.dll library. This library provides functions to access Windows registry, to restart the system, to create Windows services and to manage user accounts.

63 questions
7
votes
4 answers

Where can I find a good example of ReportEvent function usage?

As with most "legacy" MSDN pages, the page for ReportEvent has too little information for me to make much sense of it. I've tried searching, but can't find a good, clean, simple example of the function's usage. Could anyone suggest one?
Nick Bolton
  • 34,516
  • 66
  • 162
  • 230
7
votes
6 answers

Why might LsaAddAccountRights return STATUS_INVALID_PARAMETER?

Here's some C# source code which implements an unmanaged DLL (advapi32). public void AddPrivileges(string account, string privilege) { IntPtr pSid = GetSIDInformation(account); LSA_UNICODE_STRING[] privileges = new LSA_UNICODE_STRING[1]; …
Nick Bolton
  • 34,516
  • 66
  • 162
  • 230
6
votes
1 answer

CryptAcquireContext -- unresolved external

I'm linking with a third-party library (Poco C++) and getting the following unresolved symbol errors from the linker. It appears to be unable to find "CryptAcquireContextW", "CryptReleaseContext", and "CryptGenRandom". According to the Microsoft…
Bungles
  • 1,555
  • 2
  • 19
  • 41
6
votes
2 answers

I successfully called advapi32's LsaEnumerateAccountRights() from C#. Now how do I unmarshal the array of LSA_UNICODE_STRING it returns?

It's a pointer to an array of LSA_UNICODE_STRING structures. I found some code that does the inverse, i.e., create a LSA_UNICODE_STRING from a C# string. You can see that in the helper code section below. What I have up to and including the call to…
JCCyC
  • 14,557
  • 11
  • 41
  • 73
5
votes
2 answers

Logoff after logonuser on C#

I use advapi32.dll's logonuser method to access data over our network. I know it change the thread's user to the information i give it, but i was wondering if there's a way to reverse it. I want to access the data and then return to the local user…
Ben2307
  • 973
  • 3
  • 13
  • 31
5
votes
1 answer

What's making this security descriptor go bad?

I'm trying to read the access for files and directories in Windows using this code (patterned after Tim Golden's proposed patch to os.access to make it read from ACLs on Windows): from ctypes import( windll, wintypes, c_char_p, …
Stuart P. Bentley
  • 8,777
  • 7
  • 48
  • 77
5
votes
4 answers

What is RevertToSelf()? - C#.net

I don't understand what RevertToSelf() does in a .net application. Checking MSDN definition it reads the definition as The RevertToSelf function terminates the impersonation of a client application. So does the current user context changes to a…
NLV
  • 19,811
  • 35
  • 115
  • 178
5
votes
2 answers

How to impersonate another user?

I'm working on an ASP.net app and i'm trying to impersonate a user I'm creating a windowsIdentity with a token WindowsIdentity winId = new WindowsIdenty( token ); this token was got by calling the un managed code [DllImport("advapi32.dll")] public…
DJPB
  • 4,369
  • 8
  • 27
  • 42
4
votes
1 answer

How do I configure failure actions of a Windows service written in Go?

I'm writing a Windows Service in Go using the golang.org/x/sys/windows/svc package. So far, it's all working great and so easy to get started with, I love it. I've written in some auto update functionality and I'm wanting the service to restart…
iamacarpet
  • 375
  • 2
  • 11
4
votes
2 answers

Inno Setup Service Log On As

Can you advice me how to get "Log On As" parameter of specific windows service? I need to re-register service in our upgrade project and it needs to be run under the same account as it was set up originally. I've found QueryServiceConfig in…
zdenok
  • 83
  • 9
3
votes
1 answer

How to call dll files in java

I need to call a DLL file advapi32.dll in java so that i can use its CryptEncrypt function for Encryption. Is it possible to access the functions of the dll files through JNI or is there any other better ways advapi32.dll is found in system32…
Arun Michael
  • 220
  • 1
  • 12
3
votes
1 answer

EntryPointNotFoundException in advapi32.dll while starting application

I developing WPF application in Visual Studio 2013 Update 5 on windows 7 x64 SP1. After starting program download xml-file over http and parse it. All worked fine until today, and problem is that exception begin occurring suddenly, no significant…
Sam
  • 1,272
  • 2
  • 16
  • 27
3
votes
1 answer

Calling AuditQuerySystemPolicy() (advapi32.dll) from C# returns "The parameter is incorrect"

The sequence is like follows: Open a policy handle with LsaOpenPolicy() (not shown) Call LsaQueryInformationPolicy() to get the number of categories; For each category: Call AuditLookupCategoryGuidFromCategoryId() to turn the enum value into a…
JCCyC
  • 14,557
  • 11
  • 41
  • 73
3
votes
1 answer

Creating roaming user profiles programmatically on Windows 2008

Problem: Logon and load profile via LoadUserProfile API for a roaming user is not creating proper profile. This only happens under Windows 2008 (UAC off and on). Login using standard windows logon works correctly and same code works correctly on…
ao.
  • 31
  • 1
  • 2
2
votes
1 answer

macOS PowerShell Connect-PnPOnline fails due to advapi32.dll?

When I try to run the following command: PS /Users/> Connect-PnPOnline -Url https://.sharepoint.com/sites/ I get this error: Connect-PnPOnline: Unable to load shared library 'Advapi32.dll' or one of its dependencies. In order to…
1
2 3 4 5