Re: shell32: try to guess the working directory in the run dialog

2008-10-22 Thread Francois Gouget
On Tue, 21 Oct 2008, Vincent Povirk wrote: > Yep. > > It's still broken though; the string I allocated is too small (strlen > excludes the null terminator), and that will be a problem if cmdline > ends in a backslash. Also it would be nice to avoid the HEAP_ZERO_MEMORY if we are going to overwr

Re: shell32: try to guess the working directory in the run dialog

2008-10-21 Thread Vincent Povirk
Yep. It's still broken though; the string I allocated is too small (strlen excludes the null terminator), and that will be a problem if cmdline ends in a backslash. Vincent Povirk On Tue, Oct 21, 2008 at 8:41 PM, Juan Lang <[EMAIL PROTECTED]> wrote: > Oops, sorry Vincent, James caught me: > >>

Re: shell32: try to guess the working directory in the run dialog

2008-10-21 Thread Juan Lang
Oops, sorry Vincent, James caught me: > +result = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, > sizeof(WCHAR)*strlenW(cmdline)); The HEAP_ZERO_MEMORY is the something obvious I was missing. /me slinks back to his corner. --Juan

Re: shell32: try to guess the working directory in the run dialog

2008-10-21 Thread Juan Lang
> I suppose it is possible for the string to not be null-terminated if > the command line ends in a backslash. I'll fix that and resend. It's more probable than that, unless I'm missing something. You allocate result: +result = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WCHAR)*strle

Re: shell32: try to guess the working directory in the run dialog

2008-10-21 Thread Vincent Povirk
I suppose it is possible for the string to not be null-terminated if the command line ends in a backslash. I'll fix that and resend. Vincent Povirk On Tue, Oct 21, 2008 at 8:14 PM, Juan Lang <[EMAIL PROTECTED]> wrote: > Hi Vincent, > > +while (*src) > +{ > +*dest = *src; > +

Re: shell32: try to guess the working directory in the run dialog

2008-10-21 Thread Juan Lang
Hi Vincent, +while (*src) +{ +*dest = *src; +if (*src == '\\') +{ +DWORD attrs = GetFileAttributesW(result); It sure looks like you're calling GetFileAttributesW with a non-NULL-terminated string. I doubt this will work as you intend. --Juan