如何使用MFC将文件存储在Windows服务器Active Directory中 [英] How to store the files in the Windows server Active directory using MFC

查看:103
本文介绍了如何使用MFC将文件存储在Windows服务器Active Directory中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我在MFC中开发了一个应用程序,我正在创建一些XML文件来存储应用程序中的数据,并建议我将该XML文件保存在Active Directory中
为了使它们更多地保存,所以我需要将此Active Directory用作数据库来存储文件,还需要从Active Directory中保存的文件中检索数据.请问有人可以对此进行指导,以便我可以用这个来移动头.

在此先感谢.

Hello,

I have developed an application in MFC,i am creating few XML file to store the data from my application,and i was suggested to save this XML files in the Active Directory
to keep them more save.So i need to use this Active Directory as a database to store the file and also to retrieve the data from the files which are saved in the Active directory.Kindly can any one guide me for this so that i can move a head with this.

Thanks in Advance.

推荐答案

The following code example makes the existing "C:\MyFolder" directory a public file share. Later you can set passwords to that file share and also which users can access it. Below example is taken from MSDN, you can look around for more information with the ADSI interfaces. So the idea is keep in a NTFS folder and then set AD properties. Hope this helps...







IADsFileShare *pShare = NULL;
IADsContainer *pCont = NULL;
LPWSTR adsPath = L"WinNT://yourMachineName/LanmanServer";
HRESULT hr = S_OK;

hr = ADsGetObject(adsPath, IID_IADsContainer,(void**)&pCont);
if(FAILED(hr)) {goto Cleanup;}

hr = pCont->Create(CComBSTR("FileShare"), CComBSTR("Public"), (IDispatch**)&pShare);

if(FAILED(hr)) {goto Cleanup;}

hr = pShare->put_Path(CComBSTR("c:\\public"));

if(FAILED(hr)) {goto Cleanup;}

hr = pShare->SetInfo();

Cleanup:
    if(pCont) pCont->Release();
    if(pShare) pShare->Release();


这篇关于如何使用MFC将文件存储在Windows服务器Active Directory中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆