Few nitpicks about your patch.
Guy Albertelli wrote:
To zero out allocated memory you should use HEAP_ZERO_MEMORY allocation flag: input = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, i_size );
However there is no need to do any of that - do not just clear memory without a good reason. It takes time to do it, especially that you doing it several times.
What you do need to do in your code is explicitly zero-terminate all strings you receive from mount manager after you copy them.
This is wrong - types of "p" and "input" has nothing to do with each other.
This is ugly. You can write it like this:
input->DeviceNameOffset = sizeof(*input); input->DeviceNameLength = lstrlenW( nonpersist_name ) * sizeof(WCHAR) memcpy( input + 1, nonpersist_name, input->DeviceNameLength );
This doesn't look right. There are several other error codes that more appropriate. You should expand your tests to check what native returns here. Also are you sure that "size" is in chars not bytes?
Again ugly. You can write it like: volume[o1->SymbolicLinkNameLength / sizeof(WCHAR)] = 0;
You do not need to check for pointer != NULL before freeing it. All free() functions already doing it.
Vitaliy.
On Sat, 2009-05-09 at 09:52 -0600, Vitaliy Margolen wrote:
You are right, should be ERROR_FILENAME_EXCED_RANGE - at least on XP.
Will cleanup rest and resubmit with additional tests
Thanks Guy