What is a kernel equivalent for ReadFileScatter/WriteFileGather - winapi

How to perform vectored file I/O from the Windows kernel? I need an equivalent of ReadFileScatter/WriteFileGather.

NtReadFileScatter and NtWriteFileGatter Also the following might be a good addition

I believe you can use ZwReadFileScatter and ZwWriteFileGather but I can't find documentation for them on MSDN, and I don't have the DDK headers at hand.

Related

How to extend a com-file into an exe-file in Windows?

I am working on a compiler for a small (toy) language that produces 16-bit com-files, which are executable in Windows XP. However, in more modern releases of Windows com-files are executable only with the help of tools such as DosBox. I would like my compiler to produce exe-files that can be executed directly in Windows 10.
As I understand it, the exe-file needs a header that instructs the system of how to execute it. My idea is to simply add the header at the beginning of the com-file to extend it into an exe-file. I wonder if anyone can recommend an appropriate tutorial that describes how exe-files works. More specifically, I am looking for a tutorial of how to build the smallest possible working exe-file.
I also wonder if there is a difference between exe-files for 32-bit or 64-bit Windows?
Best Regards,
Stefan
You can download description exe format here. You need pecoff.docx file.
Also you may look on this old but detailed doc here.

Using windows.pas with Lazarus on OS X

I was wondering if it's possible somehow to use windows.pas on OS X with Lazarus?
I need to use special library in my project, and one of key-files uses windows.pas :( Any ideas?
Windows.pas only works on Windows. You will have to edit the library to put an IFDEF around it in the uses clause, and then provide alternatives for any functionality that is then broken. Or contact the library author and see if there is already a non-Windows version available.
You certainly cannot use Windows.pas under OSX. Because Windows.pas exposes the functionality of the Win32 library.
If you need to execute Win32 code on OSX pretty much your only option is Wine.
A more plausible solution is that you find an alternative to this "special" library to which you refer.
Windows.pas is mostly a wrapper around different DLLs contained in the Windows operating system. As it is unlikely that you will find those DLLs in OSX I guess you are out of luck.
You could check the library's source code and try to identify the constants, procedures and functions that are used in windows.pas. If it is not too much code you could try to modify the library so that it uses corresponding Carbon functions instead.
While the various answers are correct, and the vast bulk of unit windows is not portable, some functionality IS abstracted. Structures like interlockedincrement, Rect and ColorRef, and some message related functionality. Have a look at types and lcltype and the system unit interface of FPC.
A lot of Delphi code still uses Windows for that functionality, while e.g. unit types already exists since D6.
Some other things are abstracted, but not using the same (windows unit) calls. Better explain what exactly you need in a separate post.

Protecting executable in Mac OS

There are several executable protector in Windows platform which protect exe against reverse engineering such as ASProtect, PESpin, ...
How can I do it in MacOS? What is equivalent programs?
thankyou.
There is a simular post here that might be usefull.
rhinovirus recomends UPX and millenomi recomends looking at AquaticPrime
Have a look at
http://morpher.com/ and http://arxan.com/

Is there an open source equivalent of Linux' /lib/ld-linux.so for Windows?

Is there an open source program for Windows that offers the same functionality as Linux' /lib/ld‑linux.so.2?
You might want to look at the ReactOS project.
They should have everything to load DLLs, and it is open-source.
The loader is a core part of the OS on Windows; there's no open-source alternative I'm aware of, and I'm not sure it'd be possible to do it correctly in any case - you have to handle the minefield of assumptions that kernel32/ntdll have regarding address space layout, support SxS, ASLR, hotpatching, and more.
Open-source linkers are common (e.g., gnu tools), but I gather that's not what you're after.
The Enhanced Dynamic Linking Library for MinGW under MS-Windows may be helpful. Take a look especially at the bottom for the edll solution.
You mean using dynamic libraries? In Windows that's automatic when you use LoadLibrary on a .DLL.

Windows demangling library

I'm looking for an open source library to do Windows executable symbol name demangling. Does such a thing exist or must I use the Microsoft libraries?
Uow, this guy seems to have nailed it.
Not a library as such, but I'd look at Wine, specifically the debugger. I'm not sure but seems like a likely place to find code for that.
I agree that DbgHelp.dll should be the way to approach this.

Resources