Solved

IShellIconOverlayIdentifier::GetOverlayInfo implementation Explorer.exe crashing

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

HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Explorer\ShellIconOverlayIdentifiers

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

*pdwFlags = ISIOI_ICONFILE | ISIOI_ICONINDEX;
*pIndex = 0; 
*pdwFlags = ISIOI_ICONFILE | ISIOI_ICONINDEX;
 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)
	{
          Wrapper:::GetOverlayInfo()
		
	}


}

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);
0
Comment
Question by:HPFE455
[X]
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
3 Comments
 
LVL 86

Accepted Solution

by:
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


?
0
 
LVL 86

Expert Comment

by:jkr
ID: 37754356
Ooops, sorry, that should be

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

Open in new window

0
 

Author Comment

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

Featured Post

Independent Software Vendors: 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

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

690 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