FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
referencesource/System.ServiceProcess/SafeNativeMethods.cs at main · microsoft/referencesource · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
microsoft
/
referencesource
Public
Notifications
You must be signed in to change notification settings
Fork
1.3k
Star
3.4k
Code
Issues
82
Pull requests
3
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
referencesource
/
System.ServiceProcess
/
SafeNativeMethods.cs
Copy path
More file actions
More file actions
Latest commit
History
History
History
46 lines (36 loc) · 2.3 KB
Breadcrumbs
referencesource
/
System.ServiceProcess
/
SafeNativeMethods.cs
Copy path
File metadata and controls
46 lines (36 loc) · 2.3 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
//------------------------------------------------------------------------------
// <copyright file="SafeNativeMethods.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
namespace
System
.
ServiceProcess
{
using
System
;
using
System
.
Text
;
using
System
.
Security
;
using
System
.
Security
.
Permissions
;
using
System
.
Runtime
.
InteropServices
;
using
System
.
Runtime
.
ConstrainedExecution
;
[
ComVisible
(
false
)
,
SuppressUnmanagedCodeSecurityAttribute
(
)
]
internal
static
class
SafeNativeMethods
{
[
DllImport
(
ExternDll
.
Advapi32
,
CharSet
=
System
.
Runtime
.
InteropServices
.
CharSet
.
Unicode
,
SetLastError
=
true
)
]
public
extern
static
IntPtr
OpenSCManager
(
string
machineName
,
string
databaseName
,
int
access
)
;
[
DllImport
(
ExternDll
.
Advapi32
,
CharSet
=
System
.
Runtime
.
InteropServices
.
CharSet
.
Unicode
,
SetLastError
=
true
)
,
ReliabilityContract
(
Consistency
.
WillNotCorruptState
,
Cer
.
Success
)
]
public
extern
static
bool
CloseServiceHandle
(
IntPtr
handle
)
;
[
DllImport
(
ExternDll
.
Advapi32
,
CharSet
=
System
.
Runtime
.
InteropServices
.
CharSet
.
Unicode
,
SetLastError
=
false
)
]
public
static
extern
int
LsaClose
(
IntPtr
objectHandle
)
;
[
DllImport
(
ExternDll
.
Advapi32
,
SetLastError
=
false
)
]
public
static
extern
int
LsaFreeMemory
(
IntPtr
ptr
)
;
[
DllImport
(
ExternDll
.
Advapi32
,
CharSet
=
System
.
Runtime
.
InteropServices
.
CharSet
.
Unicode
,
SetLastError
=
false
)
]
public
static
extern
int
LsaNtStatusToWinError
(
int
ntStatus
)
;
[
DllImport
(
ExternDll
.
Advapi32
,
CharSet
=
System
.
Runtime
.
InteropServices
.
CharSet
.
Unicode
,
SetLastError
=
true
)
]
public
static
extern
bool
GetServiceKeyName
(
IntPtr
SCMHandle
,
string
displayName
,
StringBuilder
shortName
,
ref
int
shortNameLength
)
;
[
DllImport
(
ExternDll
.
Advapi32
,
CharSet
=
System
.
Runtime
.
InteropServices
.
CharSet
.
Unicode
,
SetLastError
=
true
)
]
public
static
extern
bool
GetServiceDisplayName
(
IntPtr
SCMHandle
,
string
shortName
,
StringBuilder
displayName
,
ref
int
displayNameLength
)
;
}
}
Back
|
FazBrowse Home
|
New Git URL