Open WebsocketUser opened 2 years ago
I use the following code to convert local empty folder to place holder file, and set pin state to CF_PIN_STATE_UNSPECIFIED, but the empty folder icon always showed unpinned state. Windows SDK:10.0.22621.0 Here also post the issue:https://docs.microsoft.com/en-us/answers/questions/987093/set-empty-folder-with-unspecified-state-icon.html
CString strFolderPath = L"C:\Users\admin\SyncFolder\emptyfolder\"; CString strFolderName = L"emptyfolder"; HRESULT hr = CfOpenFileWithOplock(strFolderPath , CF_OPEN_FILE_FLAG_EXCLUSIVE, &ProtectedHandle); if (SUCCEEDED(hr)) { hr = CfConvertToPlaceholder( ProtectedHandle, strFolderName.GetBuffer(), (USHORT)(strFolderName.GetLength() + 1) * sizeof(WCHAR), CF_CONVERT_FLAG_MARK_IN_SYNC, nullptr, NULL); CfCloseHandle(ProtectedHandle); strFolderName.ReleaseBuffer(); if (SUCCEEDED(hr)) { HANDLE hFile = ::CreateFile(strFolderPath , 0, FILE_READ_DATA, nullptr, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, nullptr); if (hFile != INVALID_HANDLE_VALUE) { hr = CfSetPinState(hFile, CF_PIN_STATE_UNSPECIFIED, CF_SET_PIN_FLAG_NONE, NULL); ::CloseHandle(hFile); } } }
I use the following code to convert local empty folder to place holder file, and set pin state to CF_PIN_STATE_UNSPECIFIED, but the empty folder icon always showed unpinned state. Windows SDK:10.0.22621.0 Here also post the issue:https://docs.microsoft.com/en-us/answers/questions/987093/set-empty-folder-with-unspecified-state-icon.html
CString strFolderPath = L"C:\Users\admin\SyncFolder\emptyfolder\"; CString strFolderName = L"emptyfolder"; HRESULT hr = CfOpenFileWithOplock(strFolderPath , CF_OPEN_FILE_FLAG_EXCLUSIVE, &ProtectedHandle); if (SUCCEEDED(hr)) { hr = CfConvertToPlaceholder( ProtectedHandle, strFolderName.GetBuffer(), (USHORT)(strFolderName.GetLength() + 1) * sizeof(WCHAR), CF_CONVERT_FLAG_MARK_IN_SYNC, nullptr, NULL); CfCloseHandle(ProtectedHandle); strFolderName.ReleaseBuffer(); if (SUCCEEDED(hr)) { HANDLE hFile = ::CreateFile(strFolderPath , 0, FILE_READ_DATA, nullptr, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, nullptr); if (hFile != INVALID_HANDLE_VALUE) { hr = CfSetPinState(hFile, CF_PIN_STATE_UNSPECIFIED, CF_SET_PIN_FLAG_NONE, NULL); ::CloseHandle(hFile); } } }