如何使用MFC将文件存储在Windows服务器Active Directory中

编程入门 行业动态 更新时间:2024-10-28 16:30:35
本文介绍了如何使用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中

本文发布于:2023-11-13 23:13:03,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1585583.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何使用   服务器   文件   MFC   Windows

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!