Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[C++] Dll program style issue

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Dami
Master Cheater
Reputation: 0

Joined: 23 Oct 2006
Posts: 336

PostPosted: Tue May 04, 2010 11:40 pm    Post subject: [C++] Dll program style issue Reply with quote

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)



Untitled-2.jpg
 Description:
 Filesize:  29.95 KB
 Viewed:  38024 Time(s)

Untitled-2.jpg


Back to top
View user's profile Send private message
Henley
Grandmaster Cheater
Reputation: 0

Joined: 03 Oct 2006
Posts: 671

PostPosted: Wed May 05, 2010 12:57 am    Post subject: Reply with quote

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
View user's profile Send private message
Slugsnack
Grandmaster Cheater Supreme
Reputation: 71

Joined: 24 Jan 2007
Posts: 1857

PostPosted: Wed May 05, 2010 2:45 am    Post subject: Reply with quote

embed a xp style manifest
Back to top
View user's profile Send private message
Dami
Master Cheater
Reputation: 0

Joined: 23 Oct 2006
Posts: 336

PostPosted: Wed May 05, 2010 2:59 am    Post subject: Reply with quote

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
View user's profile Send private message
TraxMate
Master Cheater
Reputation: 0

Joined: 01 Mar 2008
Posts: 363

PostPosted: Wed May 05, 2010 12:29 pm    Post subject: Reply with quote

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
View user's profile Send private message
Dami
Master Cheater
Reputation: 0

Joined: 23 Oct 2006
Posts: 336

PostPosted: Wed May 05, 2010 1:26 pm    Post subject: Reply with quote

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
View user's profile Send private message
Slugsnack
Grandmaster Cheater Supreme
Reputation: 71

Joined: 24 Jan 2007
Posts: 1857

PostPosted: Wed May 05, 2010 1:37 pm    Post subject: Reply with quote

http://msdn.microsoft.com/en-us/library/ms997646.aspx
Back to top
View user's profile Send private message
TraxMate
Master Cheater
Reputation: 0

Joined: 01 Mar 2008
Posts: 363

PostPosted: Wed May 05, 2010 4:45 pm    Post subject: Reply with quote

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
View user's profile Send private message
Dami
Master Cheater
Reputation: 0

Joined: 23 Oct 2006
Posts: 336

PostPosted: Thu May 06, 2010 1:08 am    Post subject: Reply with quote

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
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 457

Joined: 09 May 2003
Posts: 25262
Location: The netherlands

PostPosted: Thu May 06, 2010 8:20 am    Post subject: This post has 1 review(s) Reply with quote

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
View user's profile Send private message MSN Messenger
Dami
Master Cheater
Reputation: 0

Joined: 23 Oct 2006
Posts: 336

PostPosted: Fri May 07, 2010 4:29 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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 cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites