yaworsky at migusoft.ru
Sun Dec 19 23:26:35 CST 2004
initially i tested this stuff under XP and it raised exception if lpDatabaseName
is invalid pointer. But after you noticed the bug i run the test under 2000 and
it has been returned ERROR_NOACCESS.
Both versions return ERROR_INVALID_NAME if lpDatabaseName is empty string.
I think the patch should look like this:
@@ -750,6 +750,11 @@
if( lpDatabaseName )
+ if( IsBadStringPtrW( lpDatabaseName, -1 ) )
+ SetLastError( ERROR_NOACCESS );
+ return NULL;
if( strcmpiW( lpDatabaseName, SERVICES_ACTIVE_DATABASEW ) == 0 )
/* noop, all right */
On the other hand i think that all this stuff is a kind of masturbation.
When i implemented this, i used some tests (i'm going to put them into shape
of unit tests) to investigate the real behaviour. The last patch establishes
that behaviour replacing fixme that was an eyesore, but in reality the
database name is not used and IMO will never be used.
Ivan Leo Puoti wrote:
> This patch http://cvs.winehq.org/patch.py?id=14769 had caused a problem with Age
> of Empires. The game uses a copy protection system that is installed as a
> service, before your patch, the service tried to load the copy protection driver
> (This fails, but that's another story), after your patch wine goes straight to
> the debugger after calling OpenSCManager. I added a trace and found that this
> code is executed
> return NULL;
> and causes the crash. The value of lpDatabaseName that AoE passes to the
> function is 1; also according to MSDN
> lpDatabaseName can be NULL, and in this case SERVICES_ACTIVE_DATABASE is opened.
> As it's late here the only idea I get at the moment is to print the value as a
> FIXME or ERR or whatever, and not return NULL, as this doesn't appear to be the
> correct behavior. As you've implemented this stuff and I don't know much about
> it I would like to know what you think.
More information about the wine-devel