View previous topic :: View next topic |
Author |
Message |
cnodnarb Professional Member


Joined: 11 Sep 2002 Posts: 763 Location: Eastman, GA
|
|
Back to top |
|
 |
cnodnarb Professional Member


Joined: 11 Sep 2002 Posts: 763 Location: Eastman, GA
|
Posted: Mon Mar 17, 2014 9:58 pm Post subject: |
|
|
FAIL! Even switched to reading memory, thought it would be easier.
Code: |
#DEFINE COMMAND,REDUCEMEMORY
# create a list to hold the names and process ids of all
# running programs
list create,1
%%ProcessId_Lst = 1
List TaskList,%%ProcessId_Lst,NI
# locate the vds.exe program
%A = @match(%%ProcessId_Lst,cityofheroes.exe)
If %A
# extract the process id
PARSE "%%name;%%id",@Item(%%ProcessId_Lst)
# reduce the memory footprint of the exe.
ReduceMemory %%id
Else
Info could not find vds.exe
End
stop
:ReduceMemory
# This subroutine will reduce the memory footprint
# of the current exe or of the specified process ID
loadlib kernel32.dll
If %1
# Get a handle to the specified process
%h = @lib(kernel32,OpenProcess,INT:,INT:$1F0FFF,INT:0,INT:%1)
info %h
%S = @FILL(255)
info @len(%S)
%L = @BINARY(LARGEINT,@LEN(%S))
If @unequal(%h,0)
# reduce its current memory
%i = @lib(kernel32,ReadProcessMemory,INT:,%h,NIL:,$01671544,INT:,@addr("%S"),@addr("%L"))
if %i
info %i
end
# close the handle
%h = @lib(kernel32,CloseHandle,BOOL:,INT:%h)
End
Else
# reduce the memory usage of the current process
#%t = @lib(psapi,EmptyWorkingSet,INT:,INT:-1)
End
freelib kernel32
info @adjust(%S)
exit
|
|
|
Back to top |
|
 |
cnodnarb Professional Member


Joined: 11 Sep 2002 Posts: 763 Location: Eastman, GA
|
Posted: Tue Mar 18, 2014 6:08 pm Post subject: BUMP |
|
|
Could use help on this, otherwise I (may) have to rewrite a fairly large project in Visual Basic, which is second rate in my book ;(
I was able to write a Visual Basic DLL that does this, but for some reason it doesn't hook into a VDS executable properly. Only other VB executable will call it properly I think.
Now I do plan on writing some pretty cool DLL's for VDS in VB, but my VDSMemAddr.dll has bombed. |
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|