View previous topic :: View next topic |
Author |
Message |
Dami Master Cheater
Reputation: 0
Joined: 23 Oct 2006 Posts: 336
|
Posted: Tue May 04, 2010 11:40 pm Post subject: [C++] Dll program style issue |
|
|
My program written in bcb looses its style after its being injected to the process. I was expecting it to look like the exe on the picture.
How can the dll style be fixed/forced to be same as normally on win 7, or on any other windows its being ran on?
(attachement below) |
|
Back to top |
|
 |
Henley Grandmaster Cheater
Reputation: 0
Joined: 03 Oct 2006 Posts: 671
|
Posted: Wed May 05, 2010 12:57 am Post subject: |
|
|
You could make a loader/injector that has your dll and a manifest file embedded into itself. Before it extracts and injects the dll into the selected process, it'll extract the manifest into the process' file directory. |
|
Back to top |
|
 |
Slugsnack Grandmaster Cheater Supreme
Reputation: 71
Joined: 24 Jan 2007 Posts: 1857
|
Posted: Wed May 05, 2010 2:45 am Post subject: |
|
|
embed a xp style manifest |
|
Back to top |
|
 |
Dami Master Cheater
Reputation: 0
Joined: 23 Oct 2006 Posts: 336
|
Posted: Wed May 05, 2010 2:59 am Post subject: |
|
|
Ah so the manifest is the answer.
Thanks for the tip, il start with this and see if i get it to work.
Edit: Somehow i cant seem to get anykind of manifest to work and to solve the problem. Has anyone done this for Borland C++ Builder before? |
|
Back to top |
|
 |
TraxMate Master Cheater
Reputation: 0
Joined: 01 Mar 2008 Posts: 363
|
Posted: Wed May 05, 2010 12:29 pm Post subject: |
|
|
I have not tested it with Borland C++ Builder, but this works in VC++. Put this at the top of your .cpp file (taken from MSDN): Code: | #pragma comment(linker,"\"/manifestdependency:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\""). |
|
|
Back to top |
|
 |
Dami Master Cheater
Reputation: 0
Joined: 23 Oct 2006 Posts: 336
|
Posted: Wed May 05, 2010 1:26 pm Post subject: |
|
|
TraxMate wrote: | I have not tested it with Borland C++ Builder, but this works in VC++. Put this at the top of your .cpp file (taken from MSDN): Code: | #pragma comment(linker,"\"/manifestdependency:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\""). |
|
That code didnt seem to work at all...
Code: | [BCC32 Warning] main.cpp(1): W8094 Incorrect use of #pragma comment( <type> [,"string"] ) |
|
|
Back to top |
|
 |
Slugsnack Grandmaster Cheater Supreme
Reputation: 71
Joined: 24 Jan 2007 Posts: 1857
|
|
Back to top |
|
 |
TraxMate Master Cheater
Reputation: 0
Joined: 01 Mar 2008 Posts: 363
|
Posted: Wed May 05, 2010 4:45 pm Post subject: |
|
|
Dami3n wrote: | TraxMate wrote: | I have not tested it with Borland C++ Builder, but this works in VC++. Put this at the top of your .cpp file (taken from MSDN): Code: | #pragma comment(linker,"\"/manifestdependency:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\""). |
|
That code didnt seem to work at all...
Code: | [BCC32 Warning] main.cpp(1): W8094 Incorrect use of #pragma comment( <type> [,"string"] ) |
| Probably cuz there is a dot in the end... dunno how it got there. Anyways this is taken from one of my dll source, it should work for you too.
Code: | #include <commctrl.h>
#pragma comment(lib, "comctl32.lib")
#pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
|
|
|
Back to top |
|
 |
Dami Master Cheater
Reputation: 0
Joined: 23 Oct 2006 Posts: 336
|
Posted: Thu May 06, 2010 1:08 am Post subject: |
|
|
TraxMate wrote: | Dami3n wrote: | TraxMate wrote: | I have not tested it with Borland C++ Builder, but this works in VC++. Put this at the top of your .cpp file (taken from MSDN): Code: | #pragma comment(linker,"\"/manifestdependency:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\""). |
|
That code didnt seem to work at all...
Code: | [BCC32 Warning] main.cpp(1): W8094 Incorrect use of #pragma comment( <type> [,"string"] ) |
| Probably cuz there is a dot in the end... dunno how it got there. Anyways this is taken from one of my dll source, it should work for you too.
Code: | #include <commctrl.h>
#pragma comment(lib, "comctl32.lib")
#pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
|
|
Still the same warning message and nothing on the gui changes.
I already tried to force in the XP manifest file with winlicense, and nothing changed.
It seems that bcb doesnt support value "linker"
bcb help wrote: | #pragma comment
Syntax
#pragma comment (comment type, "string")
Description
The comment directive lets you write a comment record into an output file. The comment type can be one of the following values:
Value Explanation
exestr
The linker writes string into an .obj file. Your specified string is placed in the executable file. Such a string is never loaded into memory but can be found in the executable file by use of a suitable file search utility.
lib
Writes a comment record into an .obj file. A library module that is not specified in the linker's response-file can be specified by the comment LIB directive. The linker includes the library module name specified in string as the last library. Multiple modules can be named and linked in the order in which they are named.
user
The compiler writes string into the .obj file. The linker ignores the specified string.
ms-help://embarcadero.rs2010/rad/Pragma_comment.html |
Edit: Now that i checked the DLL with PE explorer, it seems to have a manifest like this inside it, still the style issue is same...
Code: | <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
type="win32"
name="DelphiApplication"
version="1.0.0.0"
processorArchitecture="*"/>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
publicKeyToken="6595b64144ccf1df"
language="*"
processorArchitecture="*"/>
</dependentAssembly>
</dependency>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel
level="asInvoker"
uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly> |
|
|
Back to top |
|
 |
Dark Byte Site Admin
Reputation: 468
Joined: 09 May 2003 Posts: 25706 Location: The netherlands
|
Posted: Thu May 06, 2010 8:20 am Post subject: |
|
|
place a separate application.manifest file in the folder of the application you inject the dll to
The application itself probably doesn't have styles enabled _________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
 |
Dami Master Cheater
Reputation: 0
Joined: 23 Oct 2006 Posts: 336
|
Posted: Fri May 07, 2010 4:29 am Post subject: |
|
|
Dark Byte wrote: | place a separate application.manifest file in the folder of the application you inject the dll to
The application itself probably doesn't have styles enabled |
That seems to be the answer, i injected the dll into another process which triggered the style to pop up correctly.
Thanks for the replies, another problem solved. |
|
Back to top |
|
 |
|