how to install madCollection to work with Delphi XE
how to install madCollection to work with Delphi XE
I'm new to Delphi and I want to use the "UpdateResourceW" function because the one in the windows api always returns 0
I built the madRes package and installed it
now what ?
I tried to add madRes to the uses section in the code but it didn't work
how can I include it?
I built the madRes package and installed it
now what ?
I tried to add madRes to the uses section in the code but it didn't work
how can I include it?
Re: how to install madCollection to work with Delphi XE
You should not need to build the madRes package or install it. Running the installer alone should already do the trick.
Are you using some sort of hobby/non-commercial XE build? Those don't accept pre-compiled DCUs. If that's the case, simply copy madRes.pas to your project folder, together with mad.inc, and all other units that are used by madRes internally.
Are you using some sort of hobby/non-commercial XE build? Those don't accept pre-compiled DCUs. If that's the case, simply copy madRes.pas to your project folder, together with mad.inc, and all other units that are used by madRes internally.
Re: how to install madCollection to work with Delphi XE
ok I did that
I copied the files into the project and I added them to the project files
Now what should I do to call the BeginUpdateResourceW from madRes file ?
I copied the files into the project and I added them to the project files
Now what should I do to call the BeginUpdateResourceW from madRes file ?
Re: how to install madCollection to work with Delphi XE
Well, does it compile now if you add madRes to the uses clause? If so, just do that, and then you can call "madRes.BeginUpdateResourceW".
Re: how to install madCollection to work with Delphi XE
ok I managed to get the function and call it
but it returns 0 as well
here is my code
and I'm calling it like this
what is wrong ?
but it returns 0 as well
here is my code
Code: Select all
function WriteSettings(ServerFile: PWideChar; Settings: TConfiguracoes; xResourceName: pWideChar = nil): boolean;
var
ResourceHandle: THandle;
begin
if xResourceName = nil then xResourceName := ResourceName;
Result := False;
ResourceHandle := madRes.BeginUpdateResourceW(ServerFile, False);
if ResourceHandle <> 0 then
begin
Result := UpdateResourceW(ResourceHandle, MakeIntResourceW(10), PWideChar(xResourceName), 0, @Settings, SizeOf(TConfiguracoes));
if Result then Result := EndUpdateResource(ResourceHandle, False);
end;
end;
Code: Select all
GetMem(StubFileName, sizeof(WideChar) * Succ(Length(StubFile)));
StringToWideChar(StubFile, StubFileName, Succ(Length(StubFile)));
{ShowMessage(WideCharToString(filename));}
FreeMem(StubFileName);
if WriteSettings(StubFileName, TempConfig) = False then
Re: how to install madCollection to work with Delphi XE
There's no need to do such complicated string conversions. Simply pass the string to WriteSettings as it is, then call "BeginUpdateResourceW(PWideChar(WideString(ServerFile)), False)". Delphi will do all the necessary string conversions for you.
I'm not sure why it fails. Have you tried checking GetLastError(), both after calling the OS BeginUpdateResourceW and madVR's BeingUpdateResourceW call? What does GetLastError() say in both cases?
Maybe your string conversion didn't work correctly? Or maybe you don't have write access to the file? Or maybe the file is not a valid exe/dll file? BeginUpdateResourceW only works for proper PE (exe/dll/sys/etc) files.
I'm not sure why it fails. Have you tried checking GetLastError(), both after calling the OS BeginUpdateResourceW and madVR's BeingUpdateResourceW call? What does GetLastError() say in both cases?
Maybe your string conversion didn't work correctly? Or maybe you don't have write access to the file? Or maybe the file is not a valid exe/dll file? BeginUpdateResourceW only works for proper PE (exe/dll/sys/etc) files.
Re: how to install madCollection to work with Delphi XE
Ok I did as you said and the error still the same
I traced the code and found that it stops at this point
in the BeginUpdateResourceExW function
this condition every time is false so it doesn't continue and go to the end of the function
I tried running the app I was working on in the cmd prompt and I got the following
I traced the code and found that it stops at this point
Code: Select all
if word(buf^) = CEMAGIC then begin
this condition every time is false so it doesn't continue and go to the end of the function
I tried running the app I was working on in the cmd prompt and I got the following
is this the issue ?test.exe is not compatible with the version of Windows you're running. Check your computer's system information and then contact the software publisher.
Re: how to install madCollection to work with Delphi XE
and I tried GetLastError and it returns 0
Re: how to install madCollection to work with Delphi XE
This doesn't seem to be an exe/dll/sys file. What kind of file is it?
Re: how to install madCollection to work with Delphi XE
it is a server file for the Xtreme RAT source code
Re: how to install madCollection to work with Delphi XE
What is a "server file"? Is it a PE file?