This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: cygpath hangings


On Tue, 14 Oct 2003, chris wrote:

> I decided to try to put some investigation into the cygpath crashings
> that have been reported so much. Here are my findings.. I hope this
> helps! I'd be happy to try further debuggings, except I couldn't figure
> out how to attach a debugger to the program (because as previously noted
> the hang only occurs when running from setup.exe)
>
> I used the basic setup contained in
> http://www.cygwin.com/ml/cygwin-apps/2003-10/msg00049.html , but made a
> new program I call cygcrash.cc, which I include the source code to at
> the end of this message. If I comment out the call to
> SHGetPathFromIDList in this program, the program returns, else it hangs.
>
> Also, This program seems to be both valid c++ and c code. If it is
> compiled in gcc, all is fine. In g++, it hangs.
>
> If there is anything else anyone would like me to try (like taking a -E
> and picking out all the useless bits of shlobj.h), I'd be happy to do
> so, but won't unless it will be useful to someone :)
>
> -- Code begins --
>
> #include <shlobj.h>
>
> void fee (void) {
>   char *buf;
>   LPITEMIDLIST id;
>   SHGetPathFromIDList (id, buf);
> }
>
>
> int main (int argc, char **argv)
> {
>     return 0;
> }

Chris,

I suspect that this hang might be happening while loading the DLL.  Could
you try to link your program with something like below and see if it still
hangs, and what it outputs?  If it doesn't hang, try renaming
SHGetPathFromIDList below to something else (e.g., foo) that calls the
real SHGetPathFromIDList, call foo() from your fee() above, and link your
program against both test_dll.dll and SHLWAPI.DLL.
	Igor
P.S. Please don't start new threads as replies to unrelated messages -- it
confuses threaded readers.

-------------------------- BEGIN test_dll.c --------------------------
#include <windows.h>
#include <stdio.h>
#include <shlobj.h>

static FILE *output = NULL;

void SHGetPathFromIDList(LPITEMIDLIST id, char *buf) {
  return;
}

BOOL WINAPI DllMain(HINSTANCE h, DWORD f, LPVOID r) {
  if (!output) output = stderr;
  fprintf (output, "DLL loaded: ");
  switch (f) {
    case DLL_PROCESS_ATTACH: fprintf (output, "process attach");
                             break;
    case DLL_THREAD_ATTACH:  fprintf (output, "thread attach");
                             break;
    case DLL_THREAD_DETACH:  fprintf (output, "thread detach");
                             break;
    case DLL_PROCESS_DETACH: fprintf (output, "process detach");
                             break;
    default:                 fprintf (output, "WTF?!");
  }
  fprintf (output, "\n");
  fflush (output);
  return TRUE;
}
---------- Note: cutting here may damage your screen surface ---------

-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha@cs.nyu.edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor@watson.ibm.com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"I have since come to realize that being between your mentor and his route
to the bathroom is a major career booster."  -- Patrick Naughton

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]