Since you are working in VS, why not use ATL::CString or MFC::CString?

Code:
CString sPath;
DWORD dwSize = MAX_PATH;
AssocQueryString(0, ASSOCSTR_EXECUTABLE, ".pdf", "print", path.GetBuffer( MAX_PATH ), &dwSize); 
sPath.ReleaseBuffer();
Allocating c-style strings is an opportunity for memory leaks. You can eliminate the potential problem by using string classes.