microsoft / microsoft/Windows-classic-samples
Cannot show green tick icons on empty folder(placeholder file)
Nobody has claimed this yet.
- Dominant language
- No language data
- Stars
- 5.7k
- Forks
- 3.3k
- PR merge metrics
- No merged PRs in 30d
Description
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);
}
}
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the behavior with the provided CfOpenFileWithOplock, CfConvertToPlaceholder, and CfSetPinState sequence on Windows SDK 10.0.22621.0, then compare it with the linked Microsoft Q&A discussion. The issue does not identify a repository file, test, or expected repository change, so done cannot be defined from the report alone.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- desktop, operating-systems
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100