[英]CreateDirectory fails with permission denied
I am running one dll under window C# application. 我正在Windows C#应用程序下运行一个dll。 APP call dll api for all the transaction with the system.
APP与系统的所有交易都调用dll api。 While I try for creating directory at C# app level it creates successfully but the calls fail with permission denied if dll calls createDirectory method.
当我尝试在C#应用程序级别创建目录时,它会成功创建,但是如果dll调用createDirectory方法,则调用将失败,并且权限被拒绝。 Process has full control permission.
进程具有完全控制权限。
................ code snippet ................ ................代码段................
int dlnaFileSystemNewDirPeer(char *in_name)
{
int len = dlna_strlen(in_name);
wchar_t sbuff[100];
swprintf(sbuff, len, L"%p", in_name);
int ret = CreateDirectory(sbuff, NULL);
int err = GetLastError();
if (err) {
printf("CreateDirectory fails with error:%d\n", err);
return err;
}
return ret;
}
swprintf(sbuff, len, L"%p", in_name);
You try to create the directory 0x1324000
(or whatever the address of your in_name
is). 您尝试创建目录
0x1324000
(或任何你的地址in_name
是)。
Use %S
(note the uppercase S
) or %ws
, depending on the runtime you are linking against. 使用
%S
(注意大写字母S
)或%ws
,具体取决于要链接的运行时。
See this if you are using Visual studio. 见这个 ,如果你正在使用Visual Studio。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.