Click here to Skip to main content
15,921,716 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionIs CMap's PLookup thread safe ?? Pin
rahul.kulshreshtha22-Sep-11 21:26
rahul.kulshreshtha22-Sep-11 21:26 
AnswerRe: Is CMap's PLookup thread safe ?? Pin
Niklas L23-Sep-11 0:35
Niklas L23-Sep-11 0:35 
GeneralRe: Is CMap's PLookup thread safe ?? Pin
rahul.kulshreshtha23-Sep-11 1:35
rahul.kulshreshtha23-Sep-11 1:35 
Questionadding the image in Menu Pin
sarfaraznawaz22-Sep-11 20:01
sarfaraznawaz22-Sep-11 20:01 
AnswerRe: adding the image in Menu Pin
_Flaviu22-Sep-11 21:45
_Flaviu22-Sep-11 21:45 
AnswerRe: adding the image in Menu Pin
Richard MacCutchan23-Sep-11 0:01
mveRichard MacCutchan23-Sep-11 0:01 
QuestionDirectory Size Pin
john563222-Sep-11 17:06
john563222-Sep-11 17:06 
QuestionRe: Directory Size Pin
David Crow22-Sep-11 17:17
David Crow22-Sep-11 17:17 
AnswerRe: Directory Size Pin
john563222-Sep-11 17:41
john563222-Sep-11 17:41 
AnswerRe: How to get size of all files in a directory Pin
Software_Developer22-Sep-11 22:26
Software_Developer22-Sep-11 22:26 
QuestionCode Signing Considerations Pin
Bram van Kampen22-Sep-11 13:39
Bram van Kampen22-Sep-11 13:39 
Questionuse of child CFrameWnd in Visual Studio 2008 [SOLVED] Pin
Jim Crafton22-Sep-11 4:22
Jim Crafton22-Sep-11 4:22 
QuestionPlease give me some idea 3D surface of revolution Pin
appollosputnik22-Sep-11 4:17
appollosputnik22-Sep-11 4:17 
AnswerRe: Please give me some idea 3D surface of revolution Pin
Stefan_Lang22-Sep-11 22:39
Stefan_Lang22-Sep-11 22:39 
QuestionHow to free the memory if memory is allocation using memset Pin
hema_soft21-Sep-11 23:05
hema_soft21-Sep-11 23:05 
AnswerRe: How to free the memory if memory is allocation using memset Pin
Niklas L21-Sep-11 23:12
Niklas L21-Sep-11 23:12 
AnswerRe: How to free the memory if memory is allocation using memset Pin
CPallini21-Sep-11 23:49
mveCPallini21-Sep-11 23:49 
AnswerRe: You can use the function - free() after first calling malloc() Pin
Software_Developer21-Sep-11 23:54
Software_Developer21-Sep-11 23:54 
AnswerRe: How to free the memory if memory is allocation using memset Pin
Erudite_Eric22-Sep-11 2:58
Erudite_Eric22-Sep-11 2:58 
Questionc++ objects, I don't get it - IIS ADSI object Pin
jkirkerx21-Sep-11 18:57
professionaljkirkerx21-Sep-11 18:57 
AnswerRe: c++ objects, I don't get it - IIS ADSI object Pin
XTAL25621-Sep-11 21:04
XTAL25621-Sep-11 21:04 
AnswerRe: c++ objects, I don't get it - IIS ADSI object Pin
Jim Crafton22-Sep-11 4:27
Jim Crafton22-Sep-11 4:27 
GeneralRe: c++ objects, I don't get it - IIS ADSI object Pin
jkirkerx22-Sep-11 6:17
professionaljkirkerx22-Sep-11 6:17 
GeneralRe: c++ objects, I don't get it - IIS ADSI object Pin
Jim Crafton22-Sep-11 6:24
Jim Crafton22-Sep-11 6:24 
GeneralRe: c++ objects, I don't get it - IIS ADSI object Pin
jkirkerx22-Sep-11 6:52
professionaljkirkerx22-Sep-11 6:52 
I was using the code sample to try and sort of reverse engineer some sample code, and get a clear understanding of it first. The Big Picture is that I'm trying to write my own Custom Action DLL for InstallShield Pro, that installs the web server, looks at the metadata, if it's XPPro/Vista/7 with 1 default website, then change the virtual path, program the mimes, documents so my asp.net product will work.

I didn't know what the scope of coinitialize was, or what it does, and I prefer to just write 1 giant function first.

I wrote this first, as the main function, in which I want to fork out to another function based on the IIS Version installed. But I'm stuck creating my first engine function, that does the work. in switch case 5, I want to run the IIS job.

C#
void CA_WebInfo::create_WebServer( CString msi_DIR_AppVolumeFolder_II ) {

    bool iis_Result = false;
    int program_ExitCode = 0;
    unsigned long iis_MajorVersion;
    unsigned long iis_MinorVersion;

    CA_Registry caReg;

    //Is the Web Server Installed
    iis_Result = IIS_Installed();

    if ( iis_Result == false ) {
        program_ExitCode = install_WebServer( msi_DIR_AppVolumeFolder_II );
    }

    iis_Result = IIS_Installed();

    if ( iis_Result == true ) {
        iis_MajorVersion = caReg.get_IIS_MajorVersion();
        iis_MinorVersion = caReg.get_IIS_MinorVersion();

        //Add the Website depending on the version of IIS
        int result_ADSI = 0;
        switch ( iis_MajorVersion ) {
            case 5:
                attach_IIS5_XP();
                result_ADSI = get_IIS_VirtualDirectories( 1 );

                break;

            case 6:
                break;

            case 7:
                break;


        }
    }
}


I know I have to attach to the metadata first, see what it is, and then take action. I have written this in VB with great success, but c++ is lights years away. This is my intialization of the IIS MetaData.
I hope my explanation makes sense, this is my first c++ project since 28 years ago.

HRESULT CA_WebInfo::attach_IIS5_XP(void) {
	
	HRESULT hr;
	IADs *pADs = NULL;
	IISApp2 *pApp2 = NULL;
	IISApp3 *pApp3 = NULL;
	DWORD instanceID = 1;
	int app_Level = 0;

	hr = CoInitializeEx( NULL, COINIT_MULTITHREADED );
	if ( FAILED( hr ) ) { goto error; }
	hr = ADsGetObject( L"IIS://localhost/w3svc/1/root", IID_IADs, (void **)&pADs );
	if ( FAILED( hr ) ) { 
		app_Level = 1;
		goto error;
	}
	hr = pADs->QueryInterface( IID_IISApp2, (void **)&pApp2 );
	if ( FAILED( hr ) ) { 
		app_Level = 2;
		goto error;
	}
	
	hr = pADs->QueryInterface( IID_IISApp3, (void **)&pApp3 );
	if ( FAILED( hr ) ) { 
		app_Level = 3;
		goto error;
	}


	         
	
	//The program bombed so close it
	error:
	  if ( pApp3 )
		pApp3->Release();

	  if ( pApp2 )
		pApp2->Release();

	  if ( pADs )
		pADs->Release();

	  CoUninitialize();

		return hr;
}

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.