winapi - SetNamedSecurityInfo 采用可写路径;缓冲区应该有多大?

标签 winapi path constants

SetNamedSecurityInfo被定义为采用 LPTSTR,而不是 LPCTSTR。现在采用 LPTSTR 的标准 Win32 API 也有一些指示必要缓冲区长度的方法。有时这在签名中是明确的,有时它被记录为 MAX_PATH 或其他方式。 SetNamedSecurityInfo 不是这样。

老实说,我不知道为什么 SetNamedSecurityInfo 想要写入到那个缓冲区,但也许它会尝试就地规范化路径。但是我可能需要支持 32768 个字符?

最佳答案

正如您在文档中看到的SetNamedSecurityInfo

pObjectName

A pointer to a null-terminated string that specifies the name of the object for which to set security information.

这意味着将发送到函数中的缓冲区长度始终与缓冲区的字符串长度相关。

关于winapi - SetNamedSecurityInfo 采用可写路径;缓冲区应该有多大?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55577738/

相关文章:

C++初始化常量和继承

winapi - 用于虚拟内存管理的新 Windows 8.1 API : `DiscardVirtualMemory()` vs `VirtualAlloc()` and `MEM_RESET` and `MEM_RESET_UNDO`

c++ - Win32 选择/轮询/eof/任何东西?

ios - 如何在 Xcode 的运行脚本中转义 $SRCROOT 中的空格?

javascript - 我在 Angular 2 中找不到我的服务路径

ruby - 在 Ruby 中重新分配常量时抛出异常?

c++ - 如何停止对辅助隐式加载 DLL 的 DLL 劫持

c++ - win32 内容已更改但不显示更新,除非移动窗口

python - 接收 FileNotFoundError : [Errno 2] No such file or directory

c++ - const在C++ 11中是否意味着线程安全?