FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
SharpCall/Program.cs at master · getcode2git/SharpCall · GitHub
getcode2git
/
SharpCall
Public
forked from
jhalon/SharpCall
Notifications
You must be signed in to change notification settings
Fork
1
Star
1
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
SharpCall
/
Program.cs
Copy path
More file actions
More file actions
Latest commit
History
History
History
52 lines (46 loc) · 1.69 KB
Breadcrumbs
SharpCall
/
Program.cs
Copy path
File metadata and controls
52 lines (46 loc) · 1.69 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
//
// Author: Jack Halon (@jack_halon)
// Project: SharpCall (https://github.com/jhalon/SharpCall)
// License: BSD 3-Clause
//
using
System
;
using
System
.
Runtime
.
InteropServices
;
using
static
SharpCall
.
Native
;
using
static
SharpCall
.
Syscalls
;
namespace
SharpCall
{
class
Program
{
static
void
Main
(
string
[
]
args
)
{
Microsoft
.
Win32
.
SafeHandles
.
SafeFileHandle
fileHandle
;
UNICODE_STRING
filename
=
new
UNICODE_STRING
(
)
;
RtlInitUnicodeString
(
ref
filename
,
@"\??\C:\Users\User\Desktop\test.txt"
)
;
IntPtr
objectName
=
Marshal
.
AllocHGlobal
(
Marshal
.
SizeOf
(
filename
)
)
;
Marshal
.
StructureToPtr
(
filename
,
objectName
,
true
)
;
OBJECT_ATTRIBUTES
FileObjectAttributes
=
new
OBJECT_ATTRIBUTES
{
Length
=
(
int
)
Marshal
.
SizeOf
(
typeof
(
OBJECT_ATTRIBUTES
)
)
,
RootDirectory
=
IntPtr
.
Zero
,
ObjectName
=
objectName
,
Attributes
=
0x00000040
,
// OBJ_CASE_INSENSITIVE
SecurityDescriptor
=
IntPtr
.
Zero
,
SecurityQualityOfService
=
IntPtr
.
Zero
}
;
IO_STATUS_BLOCK
IoStatusBlock
=
new
IO_STATUS_BLOCK
(
)
;
long
allocationSize
=
0
;
var
status
=
NTCreateFile
(
out
fileHandle
,
FileAccess
.
FILE_GENERIC_WRITE
,
ref
FileObjectAttributes
,
ref
IoStatusBlock
,
ref
allocationSize
,
FileAttributes
.
Normal
,
FileShare
.
Write
,
CreationDisposition
.
FILE_OVERWRITE_IF
,
CreateOption
.
FILE_SYNCHRONOUS_IO_NONALERT
,
IntPtr
.
Zero
,
0
)
;
}
}
}
Back
|
FazBrowse Home
|
New Git URL