?
Solved

IShellIconOverlayIdentifier::GetOverlayInfo implementation Explorer.exe crashing

Posted on 2012-03-22
3
Medium Priority
?
1,001 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
  • 2
3 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 2000 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

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

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

IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
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.
Suggested Courses

831 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