kernel32

Why does GetFileVersionInfo on kernel32.dll in Windows 10 return version 6.2?

百般思念 提交于 2019-12-12 07:18:29
问题 I am trying to retrieve kernel32.dll version in order to perform a Windows version check. Yet, for some reason, even though kernel32.dll 's version (as seen in file properties) is 10.0.10586.0, the returned version is: 6.2.10586.0 how come? DWORD dwDummy; DWORD dwFVISize = GetFileVersionInfoSize(lpszFilePath, &dwDummy); LPBYTE lpVersionInfo = new BYTE[dwFVISize]; if (GetFileVersionInfo(lpszFilePath, 0, dwFVISize, lpVersionInfo) == 0) { return FALSE; } UINT uLen; VS_FIXEDFILEINFO *lpFfi; BOOL

the console crashed when i try to open it twice in wpf

丶灬走出姿态 提交于 2019-12-12 06:39:54
问题 I want to open a console in wpf, I was try to open the console twice without close the program, but in the second time the program crashed, I don't really know why and I'd love to help using System; using System.Windows; using System.Runtime.InteropServices; namespace WpfApplication1 { public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); } [DllImport("Kernel32")] public static extern void AllocConsole(); [DllImport("Kernel32")] public static extern void

Win32 Assembly - Extern function naming (The meaning of '@')

孤街醉人 提交于 2019-12-12 02:42:31
问题 As I see, extern WinAPI functions in assembly code have names like _ExitProcess@4 . What is the meaning of the @4 part, and how to determine what number to use after @ ? I know that this has something to do with DLL we are linking against, but in many cases it's not known what number to use after the @ , and this leads to many nasty undefined reference errors. 回答1: As Andreas H answer said the number after the @ is the number of bytes the function removes from stack before the function

Python WaitForDebugEvent & ContinueDebugEvent (Gray Hat Python)

人盡茶涼 提交于 2019-12-12 01:09:20
问题 I'm reading 'Gray Hat Python.' There's an example where we get the thread of the process and dump all the register values. I copied down the source from the book, and it won't work. Here's a part of the source that I think is the trouble. def run(self): # Now we have to poll the debuggee for debugging events while self.debugger_active == True: self.get_debug_event() def get_debug_event(self): debug_event = DEBUG_EVENT() continue_status = DBG_CONTINUE if kernel32.WaitForDebugEvent(byref(debug

Sleeping in VBA (Integer Overflow!!)

有些话、适合烂在心里 提交于 2019-12-11 16:23:53
问题 In VBA you can Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) to provide yourself with a sleep routine. However, the Long that must be passed to the routine appears to overflow for values in excess of 32000 milliseconds. Is there a way to sleep for longer periods of time without the complexity of stringing together several consecutive calls to the sleep routine? 回答1: No, it doesn't overflow, unless your code that calculates required number of milliseconds causes an overflow.

Strange behaviour in SetSystemTime kernel32

こ雲淡風輕ζ 提交于 2019-12-11 06:29:05
问题 I have the following code: Public Class SetSystemTime Structure SYSTEMTIME Public wYear As Short Public wMonth As Short Public wDayOfWeek As Short Public wDay As Short Public wHour As Short Public wMinute As Short Public wSecond As Short Public wMilliseconds As Short End Structure Public Declare Function SetSystemTime Lib "kernel32" (ByRef lpSystemTime As SYSTEMTIME) As Boolean End Class Private Sub SetDateTime(dt As DateTime) Dim dateTimeStruct As SetSystemTime.SYSTEMTIME Dim incHour As

C# LoadLibrary ERROR_NO_TOKEN

别来无恙 提交于 2019-12-11 06:16:27
问题 I'm loading a MFC dll with dependencies (let's say I'm loading D.dll, which depends on C.dll, B.dll and A.dll) in C#. Here's my code: [DllImport( "kernel32.dll", CharSet = CharSet.Auto, SetLastError = true )] static extern IntPtr LoadLibrary( string lpFileName ); private void btn_Click( object sender, EventArgs e ) { int nUltErr; string strDLL; StringBuilder strPDF; StringBuilder strXML; strDLL = "C:\\DEVELOP\\Libs\\Interfaccia\\Interfaccia_C_2005\\DLL\\Interfaccia_C_2005.dll"; strFile1 = new

WriteFile function with assembly debugging (syncing)

江枫思渺然 提交于 2019-12-11 03:26:30
问题 First of all, this question is based on my last question here: Reading Console Buffer / Output C++ I have a compiled executable binary file. It has some outputs, what I would like to redirect it to an other program, that handles the lines. I successfully found where the output is sent, and I modified it to STDOUT. The problem is that, when I use it like: ./jampDed.exe | stdout.exe then the output is not synced. I got the content after every 1000-2000 bytes. stdout.cpp #include <iostream> int

Getting Architecture of Windows (32/64 bit version)

落爺英雄遲暮 提交于 2019-12-11 02:35:26
问题 i got a little problem: im tring to get the architecture of the OS, the problem is my programming language doesnt support such functions. Therefore i need to read this information form an windows dll (like kernel32.dll) i did try to get the infos with the functions GetNativeSystemInfo/GetVersionEx/GetSystemInfo . Unfortunately i were not able to get the architecture :/ Are there some other Functions to read the architecture in any windows dll? (it dosnt need to be kernel32 it can be any dll

Is there a managed API for kernel32.searchpath?

心不动则不痛 提交于 2019-12-10 11:17:08
问题 Is there a managed API for kernel32.searchpath? i.e not using a pinvoke. http://www.pinvoke.net/default.aspx/kernel32.searchpath 回答1: static void Main(string[] args) { string lpPath = null; string lpFileName = "notepad"; string lpExtension = ".exe"; int nBufferLength = 255; string lpBuffer = ""; string lpFilePart = ""; int bufferSize = SearchPath(lpPath, lpFileName, lpExtension, nBufferLength, out lpBuffer, out lpFilePart); } private static int SearchPath(string lpPath, string lpFileName,