Questions tagged [kernel32]

Anything related to MS Windows Kernel API (part of Windows API), residing in the `kernel32.dll` library. This library provides basic kernel services to user code, e.g. copying or locking a file, creating a mutex or a process, allocating memory, etc. This library is used by both 32-bit and 64-bit Windows, despite the name.

307 questions
4
votes
2 answers

CreateFile in Kernel32.dll returns an invalid handle

I'm trying to create a safe file handle for "C:" using the CreateFile method of kernel32.dll which always returns me an invalid handle. Any help on what am i doing wrong here?"C: CreateFile( lpFileName: "C:", dwDesiredAccess:…
4
votes
2 answers

Kernel32.INSTANCE.ReadProcessMemory cannot be found in JNA

import com.sun.jna.Native; import com.sun.jna.Memory; import com.sun.jna.Pointer; import com.sun.jna.ptr.*; import com.sun.jna.platform.win32.Kernel32; import com.sun.jna.platform.win32.User32; import…
3
votes
2 answers

SetThreadExecutionState(ES_SYSTEM_REQUIRED) does not prevent system sleep on Windows 11

In my file transfer application (WinSCP), I use SetThreadExecutionState(ES_SYSTEM_REQUIRED) to prevent the system from going into sleep mode while a file transfer is in progress. But this does not work anymore on Windows 11. I didn't find any…
Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
3
votes
0 answers

Is it possible to install a newer version of kernel32.dll into win 7 x64 that includes the function GetSystemTimePreciseAsFileTime?

Sorry for the noob question,folks. My new version of Vectorworks CAD 2022 won't run on my Win 7 x64 due to a missing procedure entry point. My laptop is too old to upgrade to Win 10 and I was hoping for a workaround, besides buying a new laptop. I…
C_Pietro
  • 41
  • 1
3
votes
2 answers

can we rebase kernel32.dll ? such that load address is different for two processes

specifically i want to know if kernel32.dll load address can be different for two processes within the same session ? I want to use createremote thread so just wanted to know if kernel32 load address in remote process can be different from the…
mohit
  • 105
  • 1
  • 8
3
votes
1 answer

GetProductInfo on an XP system

GetProductInfo(API function) seems to crash on XP Professional, while it works perfectly on Windows 7 Ultimate. What is an alternative to it?
yolo
  • 2,757
  • 6
  • 36
  • 65
3
votes
1 answer

Circular dependency errors from KERNEL32.DLL?

Recently I've had a problem that seemingly every DLL I've opened with Dependency Walker gives an error like: (Dependency Walker Module Error - "c:\windows\syswow64\MSVBVM50.DLL" will fail to load due to circular dependencies.) I'm using MSVBVM50 as…
StayOnTarget
  • 11,743
  • 10
  • 52
  • 81
3
votes
1 answer

Why does this function work well on my main machine but not on a virtual one? (GetPhysicallyInstalledSystemMemory)

I have the following code that (correctly) gives me the total installed memory on my computer (note, not the total physical memory, which would be a little less than the installed memory): using System.Runtime.InteropServices; …
S. M.
  • 227
  • 1
  • 12
3
votes
1 answer

Why does `[DllImport]` fail with an entry point of `RtlSecureZeroMemory`, even though it is a well documented entry point?

Attempting to use the kernel32 function SecureZeroMemory, using the code below, fails, with System.EntryPointNotFoundException - even though it is well documented here, on PInvoke, and here, on SO. Running completely normal Windows 10 Pro, on target…
John
  • 598
  • 2
  • 7
  • 22
3
votes
1 answer

Keep .NET console application alive until the termination sequence finishes

I am working on a data acquisition application and I want to ensure that it exits gracefully. That is, it processes all the already collected data, flushes all the (file) buffers to "disk" (persistent memory) and might even uploads the data to the…
Cerike
  • 354
  • 1
  • 15
3
votes
1 answer

How to detect Universal Windows Platform (UWP) in Delphi

To get an application written in Delphi to the Windows Store, I have to disable internal update mechanisms. For example things like "Check for updates" and such things are forbidden via Store policies 10.2.5 So, I found the C# helper function…
Anse
  • 1,573
  • 12
  • 27
3
votes
2 answers

Does kernel32 always load from System32?

Copy kernel32.dll from System32 (or SysWOW64 if you're testing with a 32-bit application) to the directory containing your EXE file Run the EXE file Process Monitor shows it doesn't even bother to check the local folder for kernel32.dll first This…
tomysshadow
  • 870
  • 1
  • 8
  • 23
3
votes
1 answer

SetSystemTime - UTC or local time?

I have a call to SetSystemTime from my c# application. However if I have the Windows timezone set to a non-zero offset from UTC, it seems sometimes to adjust the system clock as if the time I provided was UTC (i.e. converts to local time) and other…
komodosp
  • 3,316
  • 2
  • 30
  • 59
3
votes
1 answer

Determine case sensitivity of a Windows volume in kernel mode

The Windows API supports a GetVolumeInformation function. This function provides information about a Windows volume. Specifically, it returns a FILE_CASE_SENSITIVE_SEARCH switch. In the kernel there are FltQueryVolumeInformation and…
Dweeberly
  • 4,668
  • 2
  • 22
  • 41
3
votes
1 answer

Debugging a NotificationEvent in Kernel Debug (Windows)

I'm debugging a process which is like frozen: I suspect the root cause is the thread below THREAD 877f4030 Cid 0568.0fb8 that is stuck on the user-mode call to GetOverlappedResult. I have opened the dump with kd.exe. Namely, I'm interested into…
Stephane Rolland
  • 38,876
  • 35
  • 121
  • 169
1 2
3
20 21