Click here to Skip to main content
15,905,504 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
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;
}

Questionlanguage problem in C .. Pin
gateway2321-Sep-11 0:52
gateway2321-Sep-11 0:52 
AnswerRe: language problem in C .. Pin
Stefan_Lang21-Sep-11 1:39
Stefan_Lang21-Sep-11 1:39 
AnswerRe: IsTextUnicode function Pin
Software_Developer21-Sep-11 7:31
Software_Developer21-Sep-11 7:31 
QuestionCombob box get hide at mouse release Pin
Amrit Agr21-Sep-11 0:15
Amrit Agr21-Sep-11 0:15 
AnswerRe: Combob box get hide at mouse release Pin
Code-o-mat21-Sep-11 9:04
Code-o-mat21-Sep-11 9:04 
QuestionMemory Leak Pin
Tal Rasha's Guardianship20-Sep-11 17:38
Tal Rasha's Guardianship20-Sep-11 17:38 
AnswerRe: Memory Leak Pin
Stefan_Lang20-Sep-11 23:28
Stefan_Lang20-Sep-11 23:28 
AnswerRe: calculate virtual address space Pin
Software_Developer21-Sep-11 10:10
Software_Developer21-Sep-11 10:10 
AnswerRe: Memory Leak Pin
Member 441644522-Sep-11 5:23
Member 441644522-Sep-11 5:23 
QuestionUse AfxParseURLEx ? Pin
bosfan20-Sep-11 2:53
bosfan20-Sep-11 2:53 
QuestionRe: Use AfxParseURLEx ? Pin
David Crow20-Sep-11 9:18
David Crow20-Sep-11 9:18 
AnswerRe: Use AfxParseURLEx ? Pin
bosfan20-Sep-11 20:32
bosfan20-Sep-11 20:32 
GeneralRe: Use AfxParseURLEx ? Pin
XTAL25620-Sep-11 20:41
XTAL25620-Sep-11 20:41 
QuestionCOM DLL Reg Pin
john563220-Sep-11 1:38
john563220-Sep-11 1:38 
AnswerRe: COM DLL Reg Pin
Rajesh R Subramanian20-Sep-11 2:21
professionalRajesh R Subramanian20-Sep-11 2:21 
AnswerRe: COM DLL Reg Pin
Erudite_Eric20-Sep-11 22:20
Erudite_Eric20-Sep-11 22:20 
Questionhow to move mouse? Pin
catokat19-Sep-11 16:38
catokat19-Sep-11 16:38 

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.