IShellIconOverlayIdentifier::GetOverlayInfo implementation Explorer.exe crashing

Posted on 2012-03-22
Last Modified: 2012-03-22
I have created a shell IconOverlayBaseImpl class which created an entry in the registry


I have implemented  IShellIconOverlayIdentifier::GetOverlayInfo method as  a wrapper class
Wrapper:::GetOverlayInfo(LPWSTR pwszIconFile, int cchMax, int* pIndex, DWORD* pdwFlags)

*pIndex = 0; 
 wcsncpy_s(L"C:\\Users\\guest\\Desktop\\File\\Fox", 31, L"C:\\Test\\alert.ico, 31); 
return S_OK;


Wrapper::IsMemberOf(LPCWSTR pwszPath, DWORD dwAttrib )

	if(Obj.getVal("C:\\Users\\guest\\Desktop\\File\\Fox") //Bool
		return S_OK;



//IconOverlayBase::GetOverlayInfo will call shell Wrapper:GetOverlayInfo method.

IconOverlayBaseImpl::IsMemberOf(LPCWSTR pwszPath, DWORD dwAttrib )

          Hresult hr = Wrapper.IsMemberOf(pwszPath, dwAttrib);
        if(SUCCEEDED(hr) && hr == S_OK)


Open in new window

But Explorer.exe is crashing  at   wcsncpy_s(L"C:\\Users\\guest\\Desktop\\File\\Fox", 31, L"C:\\Test\\alert.ico, 31);
Question by:HPFE455
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 86

Accepted Solution

jkr earned 500 total points
ID: 37754354
Um, in the line

 wcsncpy_s(L"C:\\Users\\guest\\Desktop\\File\\Fox", 31, L"C:\\Test\\alert.ico, 31);

Open in new window

the fist parameter should be the target buffer, *not* a string literal, which causes the crash - did you mean

 wcsncpy_s(pwszIconFile, 31, L"C:\\Test\\alert.ico, 31);

Open in new window

LVL 86

Expert Comment

ID: 37754356
Ooops, sorry, that should be

 wcsncpy_s(pwszIconFile, cchMax, L"C:\\Test\\alert.ico, 31);

Open in new window


Author Comment

ID: 37755236
I was using wrognly, later I found.  thanks jkr

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
C++ assignment question 7 268
Focus not getting shifted out of  editbox 2 69
C language IDE – Compilers installation 14 78
Problem with SqlConnection 4 184
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question