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
21
votes
6 answers

CreateProcess such that child process is killed when parent is killed?

Is there a way to call CreateProcess such that killing the parent process automatically kills the child process? Perhaps using Create Process Flags? Edit The solution is to create a job object, place both parent and child in the job object. Whent…
Suraj
  • 35,905
  • 47
  • 139
  • 250
15
votes
2 answers

How to read/write memory on Mac OS X with VBA?

On Windows the declared function RtlMoveMemory provides a way to copy a block of bytes from one address to another: Private Declare PtrSafe Sub RtlMoveMemory Lib "kernel32" ( _ ByVal dest As LongPtr, _ …
michael
  • 929
  • 6
  • 19
14
votes
4 answers

C# GetProcAddress Returns Zero

For some reason, whenever my C# .NET 2.0 application makes a call to GetProcAddress it always returns zero. public class MyClass { internal static class UnsafeNativeMethods { [DllImport("kernel32.dll", CharSet = CharSet.Auto,…
Jim Fell
  • 13,750
  • 36
  • 127
  • 202
13
votes
9 answers

error cannot open file 'kernel32.lib'

I have installed VS2013 and VS2015 on Windows 7. I have an existing C++ Dll project that was building fine but now all of a sudden it wont build using VS2015 and gives me the error: LINK : fatal error LNK1104: cannot open file 'kernel32.lib' From…
Harry Boy
  • 4,159
  • 17
  • 71
  • 122
11
votes
4 answers

rename computer programmatically c# .net

I need to rename my computer via .net application. I have tried this code: public static bool SetMachineName(string newName) { MessageBox.Show(String.Format("Setting Machine Name to '{0}'...", newName)); // Invoke WMI to populate the…
N.D
  • 1,009
  • 5
  • 23
  • 39
11
votes
5 answers

How to get the "Application Name" from hWnd for Windows 10 Store Apps (e.g. Edge)

I'm trying to get an understandable "Process Name" for Windows 10 apps. Currently, all of them use ApplicationFrameHost, so I thought I could use either the ModelId or the PackageName, but it seems Windows 10 Store Apps (I tried with Mail, Store and…
Christian Rondeau
  • 4,143
  • 5
  • 28
  • 46
11
votes
5 answers

Unresolved external symbols in compiling 32 bit application in Windows 64

So I am trying to compile legacy app from 32 bit to 64 bit.. I re-compiled all of the libs it used and made it look into WIN SDK6.0A x64 bit for libs.. I am using: Visual Studio Professional Edition 2008 Visual C++ dotNet Framework 3.5 SP1 Windows…
grobartn
  • 3,510
  • 11
  • 40
  • 52
9
votes
1 answer

Shared Memory Between User Mode and Kernel Mode

I am writing some kernel side code for Windows7 to access shared memory created in user mode, as suggested here. The shared memory is created in user space with name: "MySharedMem" Opening the shared memory in user space works. Opening the same…
Stefano Piovesan
  • 1,185
  • 3
  • 19
  • 37
9
votes
1 answer

VirtualProtect and kernel32.dll - attempt to access invalid address

I'm analyzing various modules loaded by the process. Unfortunately I'm not able to create the kernel32.dll memory snapshot although the function works properly with other modules (e.g. ntddl.dll). The problem is with the following code: /* Copy code…
Adam Sznajder
  • 9,108
  • 4
  • 39
  • 60
7
votes
3 answers

Do I need to pin an anonymous delegate?

I am calling CopyFileEx from a C# application with an anonymous delegate being passed into the LPPROGRESS_ROUTINE parameter in order to get notifications on the file copy progress. My question is, does the anonymous delegate need to be pinned and…
SpeksETC
  • 1,003
  • 2
  • 7
  • 13
7
votes
1 answer

Wrapper C# for kernel32.dll API

Any helper class anywhere which wrapps kernel32 APIs, with all functions-methods and structures? Or any wrapper generator? I want ALL methods of kernel32.dll in C# like this: [DllImport("kernel32.dll",EntryPoint="RtlMoveMemory")] public…
alhambra eidos kiquenet
6
votes
1 answer

Pass a complex struct to the Windows API

I am trying to use the GetConsoleScreenBufferInfo(HANDLE, PCONSOLE_SCREEN_BUFFER_INFO) function from the Windows API using Perl 6 and (of course) NativeCall. I think I have set up the CONSOLE_SCREEN_BUFFER_INFO struct the function needs correctly,…
Holli
  • 5,072
  • 10
  • 27
6
votes
2 answers

Set windows clock in Asp.net c#

I need to set windows clock in my Asp.net website (Written in C#) I found a solution in stackoverflow at: How do I set the Windows system clock to the correct local time using C#? But when I use this I give exception: A required privilege is not…
Imran Sh
  • 1,623
  • 4
  • 27
  • 50
5
votes
2 answers

Detect if external process' window is flashing/blinking

How can I detect when a process that I'm not controlling is flashing due to some notification in it. I've seen only solutions that focus on an application that you have control over. In my case, there might be multiple instances of said process…
Deadzone
  • 793
  • 1
  • 11
  • 33
5
votes
2 answers

Any difference between kernel32.dll Sleep and Thread.Sleep()

Is there any difference(performance, implementation. .whatever) between the following: i) DllImport("kernel32.dll")] public extern static void Sleep(uint msec); ..then call Sleep function ii) Thread.Sleep()
Shamim Hafiz - MSFT
  • 21,454
  • 43
  • 116
  • 176
1
2 3
20 21