1

I want to implement a UAC prompt for an application in visualc++ the operating system is 32bit x7460(2processor) Windowsserver 2008 the exe is myproject.exe through manifest..

Here for testing i wl build the application in Windows XP OS and copy the exe in to system containg the Windowsserver vistamachine and replace it

So what i did is

peter
  • 8,158
  • 21
  • 66
  • 119
  • Please don't make us guess at the "syntax errors". – Hans Passant Jun 10 '10 at 09:03
  • I am C# guy i dont know about c++ that what the thing.but this project contain c,c++,c# i am getting so many syntax error.is there any problem when iadded line of code in Myproject.h when i commented it #define MANIFEST_RESOURCE_ID 1 MANIFEST_RESOURCE_ID RT_MANIFEST "myproject.exe.manifest" i cant see any error – peter Jun 10 '10 at 09:17
  • Lot of errors in all parts in the project which i didnt touched yet like syntax error : 'public' \\\Myproject.cpp 28 missing type specifier - int assumed. Note: C++ does not support default-int \MyprojectDlg.cpp – peter Jun 10 '10 at 09:54
  • thats my problem i added space in macro – peter Jun 10 '10 at 11:48

3 Answers3

2

I seem to recall that support for the manifest was quite flaky in Visual Studio 2005 -- it was much improved in VS2008 (though when you convert the project into 2008 you have to manually check the manifest changes it made). I would suggest not using the manifest option in the project. Instead create a post build step to embed the resource manually using the mt tool - eg see this example.

The mt tool also allows you to check the validity of the manifest. If you have the option to upgrade to VS2008 though then that is well worth doing.

the_mandrill
  • 29,792
  • 6
  • 64
  • 93
  • No i should use Visualstudio 2005 itself – peter Jun 10 '10 at 08:48
  • 1
    I would strongly advise not using VS2005 directly -- I had a lot of problems when I was trying to get a component working that needed to elevate. Doing it in a post-build step is safer IMO. To get to the bottom of your particular issue it sounds like the file just can't be found, so perhaps it's looking in a different folder, eg the project root rather than the source folder. Try running Process Monitor and then filter for 'path contains .manifest' which will show you where it's looking for the file. – the_mandrill Jun 10 '10 at 09:45
1

Try disabling the manifest tool in the project settings. In Visual Studio 2005 you can get an emdebbed manifest with the above .rc file changes. You manifest XML for UAC seems correct.

Visual Studio 2005 did not have any built-it support for embedded manifests in the resources view, but Visual Studio 2008 does.

Taneli Waltari
  • 677
  • 3
  • 5
  • i am getting so many syntax error.is there any problem when iadded line of code in Myproject.h when i commented it #define MANIFEST_RESOURCE_ID 1 MANIFEST_RESOURCE_ID RT_MANIFEST "myproject.exe.manifest" i cant see any error – peter Jun 10 '10 at 09:15
  • I am C# guy i dont know about c++ that what the thing.but this project contain c,c++,c# – peter Jun 10 '10 at 09:16
  • How to disable manifest tool in the project settings,Is it required – peter Jun 10 '10 at 09:22
  • Lot of errors in all parts in the project which i didnt touched yet like syntax error : 'public' \\\Myproject.cpp 28 missing type specifier - int assumed. Note: C++ does not support default-int \MyprojectDlg.cpp – peter Jun 10 '10 at 09:53
  • thats my problem i added space in macro – peter Jun 10 '10 at 10:42
  • Basically two steps to add manifest to an existing C++ project: 1. Create a new text file yourapp.exe.manifest and copy & paste the correct XML fragment from some sample manifest. 2. Add to your .rc file this line (RT_MANIFEST is 24 if not alrady defined in your header files) : 1 RT_MANIFEST yourapp.exe.manifest – Taneli Waltari Jun 11 '10 at 07:25
0

What exactly do you mean with "implement a UAC prompt"? IF you want your application to require administrator rights, embeding or adding the manifest is the right way to go.

You probably got the error that it failed to load the manifest because you have to specifiy include directories for resource seperately. Make sure that the folder which contains your manifest is included in the resource include paths (Right click on project -> properties -> Resources -> Additional include directories). Please note that it is not possible to elevate the rights for an already running process.

If you want to trigger an UAC prompt from a certain point in your application, there is a way to do this using this technique: http://msdn.microsoft.com/en-us/library/ms679687(VS.85).aspx

humbagumba
  • 2,054
  • 15
  • 16
  • Yes you are correct i created manifest in desktop and added it in project.Now i included it in project and did the way you mentioned added it in "Additional include directories" So that general error over But still i am getting so many syntax error.is there any problem when iadded line of code in Myproject.h when i commented it #define MANIFEST_RESOURCE_ID 1 MANIFEST_RESOURCE_ID RT_MANIFEST "myproject.exe.manifest" i cant see any error – peter Jun 10 '10 at 09:12
  • As Hans already wrote above, we will need to see those syntax errors otherwise we won't be able to help. – humbagumba Jun 10 '10 at 09:19
  • How to disable manifest tool in the project settings,Is it required – peter Jun 10 '10 at 09:24