Fail adding virtual directory to iis ftp server

  • Thread starter indarjit_pcc_consultant
  • Start date
I

indarjit_pcc_consultant

hi, there,

I want to add a virtual directory to iis ftp server by c code,
as follows:

void _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
HRESULT hRes = 0;
METADATA_HANDLE hIMSHandle;
METADATA_RECORD sMetaRecord;
DWORD dwBufLen = 0;
PBYTE pbBuffer;
WCHAR sName[MAX_PATH];
CComPtr <IMSAdminBase> pIMeta;
WCHAR lpChar[METADATA_MAX_NAME_LEN];

// Initialize COM
hRes = CoInitialize(NULL);
hRes = CoCreateInstance(CLSID_MSAdminBase,
NULL,
CLSCTX_ALL,
IID_IMSAdminBase,
(void **) &pIMeta);

if (FAILED(hRes))
return(-1);

_tcscpy(lpChar, TEXT("/LM/MSFTPSVC/1/ROOT"));
hRes = pIMeta->OpenKey(METADATA_MASTER_ROOT_HANDLE, lpChar,
METADATA_PERMISSION_WRITE, 2000, &hIMSHandle);

hRes = pIMeta->AddKey( hIMSHandle, //metabase handle
L"/vd_wfchair");

int a = HRESULTTOWIN32 (hRes);

...

}

but i failed on a == 5, which indicates ERROR_ACCESS_DENIED.

What can i do to resolve the problem?

PS: I logged in as Administrator on my Windows 2000 professional,
I know that's not enough for the above code snippet to succeed.

Any tips will be appreciated. TIA.
 
A

Alexander Bartolich

indarjit_pcc_consultant said:
hi, there,

I want to add a virtual directory to iis ftp server by c code,
as follows:

You are extremely off-topic here. Have a look at the groups in
comp.os.ms-windows.programmer.* and microsoft.*
 
P

Phil Carmody

indarjit_pcc_consultant said:
hi, there,

I want to add a virtual directory to iis ftp server by c code,
as follows:

void _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
HRESULT hRes = 0;
METADATA_HANDLE hIMSHandle;
METADATA_RECORD sMetaRecord;
DWORD dwBufLen = 0;
PBYTE pbBuffer;
WCHAR sName[MAX_PATH];
CComPtr <IMSAdminBase> pIMeta;

Well, there's your problem. You don't know the difference between
C and C++. Which is a hole in your knowledge so huge that I'd simply
give up programming entirely if I were you.
PS: I logged in as Administrator on my Windows 2000 professional,
I know that's not enough for the above code snippet to succeed.

Any tips will be appreciated. TIA.

Try Windows 2000 Incompetent instead?

And try a newsgroup specific to your platform too, as this is nothing
to do with language features, even once you've worked out what language
you're trying to program in.

Follow-ups set to somewhere more appropriate than comp.lang.c.

Phil
 
I

indarjit_pcc_consultant

sorry for any confusion, i really need to do this by c code, thanks.
 

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top