Beispiel #1
0
 private CorePathWithSubFolder[] GetPath(CoreDll.PathType pathType)
 {
     CorePathWithSubFolder[] pathWSF = new CorePathWithSubFolder[0];
     IntPtr[] size = new IntPtr[1];
     string[] path = new string[0];
     if (m_dll.adPathGetW(m_handle, pathType, new IntPtr(1), Marshal.UnsafeAddrOfPinnedArrayElement(size, 0)) ==
         CoreDll.Error.OutputBufferIsTooSmall)
     {
         char[] buffer = new char[(CoreDll.MAX_PATH_EX + 1) * size[0].ToInt32()];
         if (m_dll.adPathGetW(m_handle, pathType, Marshal.UnsafeAddrOfPinnedArrayElement(buffer, 0),
                              Marshal.UnsafeAddrOfPinnedArrayElement(size, 0)) == CoreDll.Error.Ok)
         {
             pathWSF = new CorePathWithSubFolder[size[0].ToInt32()];
             for (int i = 0; i < size[0].ToInt32(); ++i)
             {
                 pathWSF[i]      = new CorePathWithSubFolder();
                 pathWSF[i].path = BufferToString(buffer, i * (CoreDll.MAX_PATH_EX + 1), CoreDll.MAX_PATH_EX);
                 if (buffer[(CoreDll.MAX_PATH_EX + 1) * i + CoreDll.MAX_PATH_EX] == (char)1)
                 {
                     pathWSF[i].enableSubFolder = true;
                 }
                 else
                 {
                     pathWSF[i].enableSubFolder = false;
                 }
             }
         }
     }
     return(pathWSF);
 }