summaryrefslogtreecommitdiff
path: root/IconOverlayIdentifier.cpp
blob: 109bba04b43825da33ec1f643347649a25b9f856 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// 
// AUTHOR
// Stef Walter
//
// VERSION
// 0.8
// 
// LICENSE
// This software is in the public domain.
//
// The software is provided "as is", without warranty of any kind,
// express or implied, including but not limited to the warranties
// of merchantability, fitness for a particular purpose, and
// noninfringement. In no event shall the author(s) be liable for any
// claim, damages, or other liability, whether in an action of
// contract, tort, or otherwise, arising from, out of, or in connection
// with the software or the use or other dealings in the software.
// 
// SUPPORT
// Send bug reports to: <stef@memberwebs.com>
//

// IconOverlayIdentifier.cpp : Implementation of CIconOverlayIdentifier

#include "stdafx.h"
#include "IconOverlayIdentifier.h"

const CLSID CLSID_IconOverlayIdentifier = { 0x42DFB913,0x6291,0x42C6,{0xB3,0x12,0x90,0x1B,0xA1,0x97,0x3D,0x00} };


/////////////////////////////////////////////////////////////////////////////
// CIconOverlayIdentifier

STDMETHODIMP CIconOverlayIdentifier::GetOverlayInfo(LPWSTR pwszIconFile, int cchMax, int *pIndex, DWORD *pdwFlags)
{
	// Tell the shell which icon to use
	GetModuleFileNameW(_Module.GetModuleInstance(), pwszIconFile, cchMax);
	*pIndex = 0;
	*pdwFlags = ISIOI_ICONINDEX | ISIOI_ICONFILE;

	return S_OK;
}

STDMETHODIMP CIconOverlayIdentifier::GetPriority(int* pPriority)
{
	// We go for top priority
	*pPriority = 0;
	return S_OK;
}

STDMETHODIMP CIconOverlayIdentifier::IsMemberOf(LPCWSTR pwszPath, DWORD dwAttrib)
{
	// See if the file given is encrypted
	DWORD status = 0;
	FileEncryptionStatusW(pwszPath, &status);

	ATLTRACE(L"%s%s\n", pwszPath, status == FILE_IS_ENCRYPTED ? L" - encrypted" : L"");

	return status == FILE_IS_ENCRYPTED ? S_OK : S_FALSE;
}