forked from zamabuvaraeu/COM_DOS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreplace.vbs
62 lines (38 loc) · 2.89 KB
/
replace.vbs
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
Option Explicit
Dim FSO
Set FSO = CreateObject("Scripting.FileSystemObject")
Dim TextStream
Set TextStream = FSO.OpenTextFile(WScript.Arguments(0), 1)
Dim Lines
Lines = TextStream.ReadAll
TextStream.Close
Set TextStream = Nothing
Dim LinesArray
LinesArray = Split(Lines, vbCrLf)
Dim i
For i = 0 To UBound(LinesArray)
Select Case LinesArray(i)
Case "int32 memcmp( void*, void*, uint64 );"
LinesArray(i) = "int32 memcmp( const void*, const void*, uint64 );"
Case "void* memcpy( void*, void*, uint64 );"
LinesArray(i) = "void* memcpy( void*, const void*, uint64 );"
Case "void* memmove( void*, void*, uint64 );"
LinesArray(i) = "void* memmove( void*, const void*, uint64 );"
Case "int64 _InterlockedExchangeAdd64( int64*, int64 );"
LinesArray(i) = "int64 _InterlockedExchangeAdd64( volatile int64*, int64 );"
Case "int32 _InterlockedExchangeAdd( int32*, int32 );"
LinesArray(i) = "long _InterlockedExchangeAdd( volatile long*, long );"
End Select
If InStr(LinesArray(i), "@llvm.global_ctors = ") Then
LinesArray(i) = "; " & LinesArray(i)
End If
If InStr(LinesArray(i), "__builtin_memset( &fb$result$1") Then
LinesArray(i) = "/* " & LinesArray(i) & " */"
End If
Next
Lines = Join(LinesArray, vbCrLf)
Set TextStream = FSO.OpenTextFile(WScript.Arguments(0), 2)
TextStream.WriteLine Lines
TextStream.Close
Set TextStream = Nothing
Set FSO = Nothing