git://wimlib.net
/
wimlib
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Improve random number generation
[wimlib]
/
src
/
win32_apply.c
diff --git
a/src/win32_apply.c
b/src/win32_apply.c
index f971ca6f8bdeaf12c0f479832d36706edd1bd83c..96d9df6f578842eea91fc7b5308066b9a0df5715 100644
(file)
--- a/
src/win32_apply.c
+++ b/
src/win32_apply.c
@@
-807,7
+807,7
@@
end_wimboot_extraction(struct win32_apply_ctx *ctx)
build_win32_extraction_path(dentry, ctx);
build_win32_extraction_path(dentry, ctx);
-
randomize_char_array_with_alnum
(subkeyname, 20);
+
get_random_alnum_chars
(subkeyname, 20);
subkeyname[20] = L'\0';
res = RegLoadKey(HKEY_LOCAL_MACHINE, subkeyname, ctx->pathbuf.Buffer);
subkeyname[20] = L'\0';
res = RegLoadKey(HKEY_LOCAL_MACHINE, subkeyname, ctx->pathbuf.Buffer);
@@
-1268,18
+1268,11
@@
retry:
FileShortNameInformation);
if (status == STATUS_INVALID_PARAMETER && !retried) {
FileShortNameInformation);
if (status == STATUS_INVALID_PARAMETER && !retried) {
-
/* Microsoft forgot to make it possible to remove short names
* until Windows 7. Oops. Use a random short name instead. */
/* Microsoft forgot to make it possible to remove short names
* until Windows 7. Oops. Use a random short name instead. */
-
+ get_random_alnum_chars(info->FileName, 8);
+ wcscpy(&info->FileName[8], L".WLB");
info->FileNameLength = 12 * sizeof(wchar_t);
info->FileNameLength = 12 * sizeof(wchar_t);
- for (int i = 0; i < 8; i++)
- info->FileName[i] = 'A' + (rand() % 26);
- info->FileName[8] = L'.';
- info->FileName[9] = L'W';
- info->FileName[10] = L'L';
- info->FileName[11] = L'B';
- info->FileName[12] = L'\0';
retried = true;
goto retry;
}
retried = true;
goto retry;
}