- VirtualProtect_() won't allow me to modify permissions on a shared API...
- I can bypass VirtualProtect_() by using an undocumented API called VxDCall()
- With VxDCall() I can call _PageModifyPermissions directly and make shared memory writable
API Hooking for FreeStyle
-
PolyVector
- Enthusiast

- Posts: 499
- Joined: Wed Sep 17, 2003 9:17 pm
- Location: Southern California
- Contact:
API Hooking for FreeStyle
I need to hook a shared API in Windows9x to continue development on FreeStyle. Without this capability FreeStyle can't function properly in 9x! Here's what I know so far:
Not sure if this helps but have you tried VirtualProtectEx
MSDN SDK wrote:The VirtualProtect function changes the protection on a region of committed pages in the virtual address space of the calling process.
To change the access protection of any process, use the VirtualProtectEx function.
Client: Included in Windows XP, Windows 2000 Professional, Windows NT Workstation, Windows Me, Windows 98, and Windows 95.
What goes around comes around.
PB 5.21 LTS (x86) - Windows 8.1
PB 5.21 LTS (x86) - Windows 8.1
-
PolyVector
- Enthusiast

- Posts: 499
- Joined: Wed Sep 17, 2003 9:17 pm
- Location: Southern California
- Contact:
no form of VirtualProtect will allow you to modify permissions of Shared memory
It uses INT 2Eh to copy shared memory (on win9x)... It's the lowlevel equivilent of CopyMemory() on win9x
EDIT: SOLVED!
Here's the function if anybody's interested... It can copy ANY MEMORY on 9x... this includes protected/shared/whatever...
If anybody could help me getting this asm to work w/ PB it would be great:Windows Me/98/95: You cannot use VirtualProtectEx on any memory region located in the shared virtual address space (from 0x80000000 through 0xBFFFFFFF).
It uses INT 2Eh to copy shared memory (on win9x)... It's the lowlevel equivilent of CopyMemory() on win9x
Code: Select all
i2E_RtlCopyMemory equ 0000010Ah
mov eax, i2E_RtlCopyMemory
lea edx, stk
int 2Eh
...
stk: dd 0BFF7xxxxh ; edi (destination)
dd offset vir_code ; esi (source)
dd vir_size ; ecx (length in bytes)
EDIT: SOLVED!
Here's the function if anybody's interested... It can copy ANY MEMORY on 9x... this includes protected/shared/whatever...
Code: Select all
Procedure Win9x_RtlCopyMemory(SourceMemory.l,DestinationMemory.l,Length.l)
stk=AllocateMemory(3*4)
PokeL(stk+0,DestinationMemory)
PokeL(stk+4,SourceMemory)
PokeL(stk+8,Length)
MOV eax, #i2E_RtlCopyMemory
MOV edx, stk
INT 2Eh
FreeMemory(Buffer)
EndProcedure-
FloHimself
- Enthusiast

- Posts: 229
- Joined: Wed May 14, 2003 3:38 pm
- Location: Lüneburg - Germany
-
PolyVector
- Enthusiast

- Posts: 499
- Joined: Wed Sep 17, 2003 9:17 pm
- Location: Southern California
- Contact:
Well I solved that one hurtle for 9x api hooking... Now I need to write a small code-generator to create functions in shared memory that check what the current process is and compare it with a list... And ever time i try code that fails I have to rebootsolved polyvector?
At least VMWare is my friend!
My work is never done!
-
PolyVector
- Enthusiast

- Posts: 499
- Joined: Wed Sep 17, 2003 9:17 pm
- Location: Southern California
- Contact:
gotta' love vmware! although i managed to crash the host now one time by doing something within vmware, security is not a 100% tight it appears
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB - upgrade incoming...)
( The path to enlightenment and the PureBasic Survival Guide right here... )
( The path to enlightenment and the PureBasic Survival Guide right here... )
