forked from ArcadeHustle/RingEdge_NoKey_softmod
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TrueCrypt-win32_keydump.patch
103 lines (99 loc) · 2.45 KB
/
TrueCrypt-win32_keydump.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
--- Common/Keyfiles.c Wed May 06 18:47:01 2020
+++ Common/Keyfiles.c Tue May 27 17:32:20 2014
@@ -162,41 +162,6 @@
f = fopen (keyFile->FileName, "rb");
if (f == NULL) return FALSE;
- /* Dump key to file */
- {
- FILE * myfile = NULL;
- char filepath[512];
-
- for (int asd = 0; asd < INT_MAX; asd++)
- {
- snprintf(filepath, sizeof(filepath), "C:\\keyfile_%d.bin\0 EDIT PATH HERE", asd);
-
- /* Is file existing ?*/
- myfile = fopen(filepath, "rb");
-
- if (NULL == myfile)
- {
- /* File is not existing - open new file */
- myfile = fopen(filepath, "wb");
- break;
- }
- }
-
- /* Write new file */
- if (NULL != myfile)
- {
- while ((bytesRead = fread(buffer, 1, sizeof(buffer), f)) > 0)
- {
- fwrite(buffer, 1, bytesRead, myfile);
- }
-
- fclose(myfile);
- fseek(f, 0, SEEK_SET);
-
- }
- }
-
-
while ((bytesRead = fread (buffer, 1, sizeof (buffer), f)) > 0)
{
size_t i;
@@ -269,36 +234,6 @@
VirtualLock (keyPool, sizeof (keyPool));
memset (keyPool, 0, sizeof (keyPool));
-
- /* Dump password to file */
- {
- FILE * myfile = NULL;
- char filepath[512];
-
- for (int asd = 0; asd < INT_MAX; asd++)
- {
- snprintf(filepath, sizeof(filepath), "C:\\password_%d.bin\0 EDIT PATH HERE", asd);
-
- /* Is file existing ?*/
- myfile = fopen(filepath, "r");
-
- if (NULL == myfile)
- {
- /* File is not existing - open new file */
- myfile = fopen(filepath, "w");
- break;
- }
- }
-
- /* Write new file */
- if (NULL != myfile)
- {
- fwrite(password->Text, 1, password->Length, myfile);
- fclose(myfile);
- }
- }
-
-
for (kf = firstKeyFile; kf != NULL; kf = kf->Next)
{
// Determine whether it's a security token path
@@ -350,10 +285,7 @@
}
// Determine whether it's a path or a file
- //if (stat (kf->FileName, &statStruct) != 0)
- //todo //GetFileAttributesEx(kf->FileName)
-
- if(FILE_ATTRIBUTE_DIRECTORY == GetFileAttributes(kf->FileName))
+ if (stat (kf->FileName, &statStruct) != 0)
{
handleWin32Error (MainDlg);
Error ("ERR_PROCESS_KEYFILE");
@@ -385,8 +317,7 @@
);
// Determine whether it's a path or a file
- //if (stat (kfSub->FileName, &statStruct) != 0)
- if (FILE_ATTRIBUTE_DIRECTORY == GetFileAttributes(kfSub->FileName))
+ if (stat (kfSub->FileName, &statStruct) != 0)
{
handleWin32Error (MainDlg);
Error ("ERR_PROCESS_KEYFILE");