BOOL FO_CreateVirtualSite (LPCTSTR lpszVirtualDirName, LPCTSTR lpszDiskPath, LPCTSTR lpszSitePath) {IADsContainer * iContainer; IADs * iAds; / * get WebSever * / if (ADsGetObject (L "IIS: // localhost /", IID_IADsContainer, (void **) & iContainer) == S_OK) {// long g = 0; // icontainer-> get__newenum // icontainer-> get_count (& g);
// This is available in the way. There is no specific implementation here, so this example can only establish a site.
Long i = 20; Char C [10]; ZeromeMory ((pvoid) C, 10); ITOA (I, C, 10); // Establish virtual site IF (icontainer-> Create (l "iiswebserver", _bstr_t (c ), (Idispatch **) & Iads) == s_ok) {// Setting the property Variant Var; VariantNit (& var); v_bstr (& var) = sysallocstring (_vt (& var) = vt_bstr; IADS -> Put (L "servercomment", var); // Set site name VariantClear (& var); v_bstr (& var) = sysallocstring (l ": 9999:"); v_vt (& var) = vt_bstr; Iads-> Put (L "Serverbindings", var); // // Set site port number variantclear (& var); v_bstr (& var) = sysallocstring (l "default.asp, index.asp, default.htm, index.htm"); v_vt (& var) = VT_BSTR; IADS-> PUT (L "defaultdoc", var); // Setting the default start file VariantClear (& var); v_bstr (& var) = sysallocstring (l "true"); v_vt (& var) = vt_bool; Iads- > PUT (L "Accessscript", var); // Setting read permissions Iads-> Put (L "AccessRead", var); Iads-> Put (L "AccessWrite", Var); VariantClear (& var); v_ui4 ( & var) = 1; // DWORD Type v_vt (& var) = VT_UI4; IADS-> PUT (L "ServerAutostart", var); // VariantClear (& Var); Iads-> setInfo (); if (ADSGETOBJECT (L "IIS: // LocalHost / W3SVC", IID_IADSCONTAINER, (Void **) & icontainer == S_OK) {if (icontainer-> getObject (l "iiswebserver", _bstr_t ( c), (idispatch **) & IADS) == s_ok) {if (IADS-> Queryinterface (IID_IADSCONTAINER, (Void **) & icontainer) == S_OK) {Create a new site root directory IF (icontainer-> Create (L " Iiswebvirtualdir, L "root", (idispatch **) & Iads) ==