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.

75 questions
3
votes
1 answer

Which returned parameters do I need to free from GetNamedSecurityInfo API?

When I called GetNamedSecurityInfo API and it succeeded, the MSDN states that I need to call LocalFree on ppSecurityDescriptor, but what about ppDacl and ppSacl?
ahmd0
  • 16,633
  • 33
  • 137
  • 233
3
votes
1 answer

can't logon with logonuser function with correct credentials C#

I use the impersonate mechanism to manage services on a distant machine I can connect to that machine with my username and password on an RDP session and start/stop services manually. I also managed to start/stop services through code using the…
amitfr
  • 1,033
  • 1
  • 9
  • 29
2
votes
1 answer

When a process is elevated how can I get the windows authentication ID of the non elevated session

I need to get the AuthenticationID as returned by GetTokenInformation with the TokenStatistics class for the user that logged in on the station whether I'm elevated or not. Lemme give you some more info. Suppose I do : var Result =…
Sébastien Nussbaumer
  • 6,202
  • 5
  • 40
  • 58
2
votes
0 answers

Referencing an ExcelApp Object Running in a Different Process (by A Different User) in VB6

My app is supposed to take user inputs and archive them in Excel files. All of that would work if I didn't need to access said Excel files as a special user due to the company's safety restrictions. I have working code that opens said restricted…
O_W
  • 37
  • 4
2
votes
1 answer

How to write to windows eventlog using Java and JNA

I was looking at a way to write to windows event log using JNA. I am able to write to windows event log using log4J2 and Log4JNA libraries. However, I would like to write directly using JNA and I am not comfortable having to add a dll file, which is…
Praveen Kumar
  • 1,515
  • 1
  • 21
  • 39
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…
2
votes
0 answers

JNI Error: com.sun.jna.platform.win32.Win32Exception: The system cannot find the file specified

I'm using JNA 4.2.1 to access Windows Registry from Java (unfortunately it's only way to get the list of paired Bluetooth devices). It was working okay, until Windows 10 has installed some updates, now I have the following…
user3900156
2
votes
1 answer

Call Advapi32.dll native EventWrite function from C#?

I'm trying to use C# .Net to trigger Window's Service Trigger Events. Specifically, I'm trying to trigger this event so that the WebClient service is started from an unprivileged account. C:\>sc qtriggerinfo WebClient [SC] QueryServiceConfig2…
Petey B
  • 11,439
  • 25
  • 81
  • 101
2
votes
1 answer

Trying to call wincred api using ctypes

I am trying to read the Windows Credential vault using ctypes API, but I am unsure how to cast back the function result back into a usable ctypes.Structure. import ctypes class CREDENTIALS(ctypes.Structure): _fields_ = [ ("Flags",…
Stavr00
  • 3,219
  • 1
  • 16
  • 28
2
votes
1 answer

What's the best strategy to crawl very big filesystem?

I need to get the owner for about 100,000,000 windows network files distributed amongst several shares. I'am using advapi32 GetNamedSecurityInfo function from within C# code, but it's a long running process. I'm currently crawling several shares in…
1
vote
0 answers

Registry key permissions are not propagated to existing subkeys

I'm setting ACL on the registry key by pinvoking this native method: [DllImport(@"advapi32.dll", EntryPoint = "RegSetKeySecurity", SetLastError = true)] internal static extern int RegSetKeySecurity(SafeRegistryHandle handle, uint…
kateroh
  • 4,382
  • 6
  • 43
  • 62
1
vote
0 answers

Want to launch process 'X' as using token of user 'B' in session of user ‘A’ by AdvApi in service code

We have service which is running as system session. Taking token of User 'B' In this token changing session id of User 'A' Using this token launching the process 'X' After process 'X' launch getting error The exception unknown software exception…
1
vote
0 answers

copy files to a remote server with credentials from inside a docker container in .Net 6.0

I have a requirement where I need to copy files to a remote server with credentials from a .Net 6.0 application hosted in a docker container. I can do this easily by impersonating the service account in VS (using WindowsIdentity.RunImpersonated) but…
pal
  • 11
  • 4
1
vote
1 answer

Need help translating C _TRUSTEE_W typedef to C# struct

I am looking to use the GetEffectiveRightsFromAclW Win32 function in .NET Framework. One of the parameters is of type PTRUSTEE_W. Insofar as what I've come across, this is a rather complex C type: typedef struct _TRUSTEE_W { struct _TRUSTEE_W …
Mike Bruno
  • 600
  • 2
  • 9
  • 26
1
vote
0 answers

C# with AES256 and SHA512 file encryption/decrption

I was working a while ago with AHK (Autohotkey) and I found the crypt.ahk is handy in encrypting/decrypting files. I also decided to use an AES256 with SHA512 and a "Password". Here you can see a short code from the crypto.ahk file: if…