Solved

IShellIconOverlayIdentifier::GetOverlayInfo implementation Explorer.exe crashing

Posted on 2012-03-22
3
915 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 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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
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…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

762 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now