Click here to Skip to main content
15,896,063 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
AnswerRe: Generic terms....!!! plz help Pin
Richard MacCutchan31-Jan-12 21:27
mveRichard MacCutchan31-Jan-12 21:27 
AnswerRe: Generic terms....!!! plz help Pin
Richard MacCutchan1-Feb-12 3:38
mveRichard MacCutchan1-Feb-12 3:38 
RantRe: Generic terms....!!! plz help Pin
♥…ЯҠ…♥6-Feb-12 17:39
professional♥…ЯҠ…♥6-Feb-12 17:39 
GeneralRe: Generic terms....!!! plz help Pin
Richard MacCutchan6-Feb-12 22:37
mveRichard MacCutchan6-Feb-12 22:37 
QuestionMS C++ gives error for fully-qualified ctor name in initializer list Pin
old_hacker27-Jan-12 11:23
old_hacker27-Jan-12 11:23 
SuggestionRe: MS C++ gives error for fully-qualified ctor name in initializer list Pin
Pablo Aliskevicius28-Jan-12 22:25
Pablo Aliskevicius28-Jan-12 22:25 
AnswerRe: MS C++ gives error for fully-qualified ctor name in initializer list Pin
Richard MacCutchan28-Jan-12 22:37
mveRichard MacCutchan28-Jan-12 22:37 
QuestionCan you help me solve my OTS Elevated COM Object error? Pin
Christine_Irene26-Jan-12 3:08
Christine_Irene26-Jan-12 3:08 
Hi,

I have a COM dll with a class in it. This class alters the registry at HKLM\Software\Policies\MyPolicy

The DLL has a UAC execution level of Highest Available (I think I had it still happen with asInvoker as well).

The executable that cals this dll has an execution level of invoker.

If I run this as administrator, I get the UAC prompt when my class gets invoked, and I see all my debug messages in dbgview and any debug message boxes show up.

If I log in as standard user, and right click runas administrator, everything works fine.

However, If I simply double-click, I see the UAC elevation prompt when my class gets invoked. I enter in the correct password, and the COM object creation passes, but the Registry is never changed, AND I do not see any debug messages or message boxes. If I turn off "Run all administrators in admin approval mode", I see the messages, but the program fails to set the registry keys.

Anybody have any clues? Also, do you know of any great debuggers that I may use to solve this?


More Info:

I am building it in VS 2008, but it is using visual studio version 2.0 with MFC setting to 'using standard windows libraries' and Use of ATL set to 'Dynamic Link to ATL'

I explicitly add the additional registry settings to get the elevation to work in the DllRegisterServer function.

I add the following keys to the registry:
HKLM\Software\Classes\AppID\My AppGuid(found in dllMain.h)>\ROTFlags(a string set to "1")
HKLM\Software\Classes\AppID\My AppGuid\DllSurrogate(a string set to empty)

HKLM\Software\Classes\CLSID\My ClassID (found in ClassName.rgs)\AppID (a string set to My AppGuid)
HKLM\Software\Classes\CLSID\My ClassID\LocalizedString (an expanding string set to @dllPath.dll,-100(where 100 is a string
in the string table)).

HKLM\Software\Classes\CLSID\My ClassID\Elevation\Enabled (a DWORD set to 1)

HKLM\Software\Classes\CLSID\My ClassID\Elevation\IconReference (An expanding string set to 'applicationIcon')

Also, my calling code uses the standard old

HRESULT CallingClass::CoCreateInstanceAsAdmin(HWND hwnd,REFCLSID rClsid, REFIID rIid, void** ppv)
{
  try
  {

    HRESULT     hr;
    BIND_OPTS3	bo;
    WCHAR		wszCLSID[255];
    WCHAR		wszMonikerName[300];

    StringFromGUID2(rClsid,wszCLSID,sizeof(wszCLSID)/sizeof(wszCLSID[0])); 

    hr = StringCchPrintf(
       wszMonikerName,sizeof
       (wszMonikerName)/
       sizeof(wszMonikerName[0]),   
       L"Elevation:Administrator!new:%s", 
       wszCLSID);

    if(FAILED(hr))
    {
      . . .ShowMyDebugMessage		
      return hr;
    }

    memset(&bo, 0, sizeof(bo));
    bo.cbStruct	= sizeof(bo);
    bo.hwnd	= hwnd;
    bo.dwClassContext = CLSCTX_LOCAL_SERVER;
    return CoGetObject(wszMonikerName, 
        &bo, rIid, ppv );
  }
  catch(...)
  {
    . . .Show my debug message
    return E_FAIL;
  }

  return S_OK;

}

Christine Murphy
C# developer

QuestionStore STL iterator in CListBox Pin
LionAM17-Jan-12 0:36
LionAM17-Jan-12 0:36 
AnswerRe: Store STL iterator in CListBox Pin
Richard MacCutchan17-Jan-12 0:52
mveRichard MacCutchan17-Jan-12 0:52 
GeneralRe: Store STL iterator in CListBox Pin
LionAM17-Jan-12 1:11
LionAM17-Jan-12 1:11 
GeneralRe: Store STL iterator in CListBox Pin
Richard MacCutchan17-Jan-12 1:31
mveRichard MacCutchan17-Jan-12 1:31 
GeneralRe: Store STL iterator in CListBox Pin
LionAM17-Jan-12 2:02
LionAM17-Jan-12 2:02 
GeneralRe: Store STL iterator in CListBox Pin
Richard MacCutchan17-Jan-12 3:00
mveRichard MacCutchan17-Jan-12 3:00 
GeneralRe: Store STL iterator in CListBox Pin
LionAM17-Jan-12 5:16
LionAM17-Jan-12 5:16 
GeneralRe: Store STL iterator in CListBox Pin
Richard MacCutchan17-Jan-12 5:22
mveRichard MacCutchan17-Jan-12 5:22 
GeneralRe: Store STL iterator in CListBox Pin
LionAM17-Jan-12 9:09
LionAM17-Jan-12 9:09 
GeneralRe: Store STL iterator in CListBox Pin
Richard MacCutchan17-Jan-12 9:31
mveRichard MacCutchan17-Jan-12 9:31 
AnswerRe: Store STL iterator in CListBox Pin
«_Superman_»18-Jan-12 18:23
professional«_Superman_»18-Jan-12 18:23 
GeneralRe: Store STL iterator in CListBox Pin
LionAM19-Jan-12 9:04
LionAM19-Jan-12 9:04 
AnswerRe: Store STL iterator in CListBox Pin
Orjan Westin19-Jan-12 4:24
professionalOrjan Westin19-Jan-12 4:24 
GeneralRe: Store STL iterator in CListBox Pin
LionAM19-Jan-12 8:54
LionAM19-Jan-12 8:54 
GeneralRe: Store STL iterator in CListBox Pin
Orjan Westin19-Jan-12 23:38
professionalOrjan Westin19-Jan-12 23:38 
GeneralRe: Store STL iterator in CListBox Pin
LionAM20-Jan-12 11:04
LionAM20-Jan-12 11:04 
AnswerRe: Store STL iterator in CListBox Pin
Emilio Garavaglia25-Jan-12 21:22
Emilio Garavaglia25-Jan-12 21:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.