Windows: Fix qt_ntfs_permission_lookup 1512
authorMiikka Heikkinen <miikka.heikkinen@digia.com>
Mon, 9 Jan 2012 09:24:33 +0000 (11:24 +0200)
committerMiikka Heikkinen <miikka.heikkinen@digia.com>
Mon, 9 Jan 2012 10:13:26 +0000 (12:13 +0200)
commitb39d95451ca0c5a453c7382b7ae2f37b0d7ef752
tree026b637e56ac514fdbcf23058407cb22ee810ba9
parent7143a4542e436ffa537274688f812893da66fc13
Windows: Fix qt_ntfs_permission_lookup

Specifying qt_ntfs_permission_lookup++ in application code didn't
make qfilesystemengine_win.cpp respect Windows ACL as it was supposed
to. This was because GetTokenInformation for TokenUser failed always in
resolveLibs() function, because the TOKEN_USER struct that was given to
it wasn't large enough to contain both TOKEN_USER and SID structs that
GetTokenInformation wants to return in this case.

Fixed by calling GetTokenInformation twice, first to determine the
required size, and then another time to get the actual token info.
Additionally, the SID returned as part of the token info needs to be
stored for the lifetime of the application, as the TRUSTEE_W struct
has a pointer to it (currentUserTrusteeW).

The worldTrusteeW initialization also required a change to properly
store the SID.

Task-number: QTBUG-247
Reviewed-by: pending
src/corelib/io/qfilesystemengine_win.cpp