Hi,
ich habe gerade ein Problem mit einer C# Klasse.
Ein Code spricht mehr als 1000 Worte:
LowSys.cs:
|
C#-Quelltext
|
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
104
105
|
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
//namespace LowSys{
public struct PROCESS_INFORMATION{
public IntPtr hProcess;
public IntPtr hThread;
public uint dwProcessId;
public uint dwThreadId;
};
public struct STARTUPINFO{
public uint cb;
public string lpReversed;
public string lpDesktop;
public string lpTitle;
public uint dwX;
public uint dwY;
public uint dwXSize;
public uint dwYSize;
public uint dwXCountChars;
public uint dwYCountChars;
public uint dwFillAttribute;
public uint dwFlags;
public short wShowWindow;
public short cbReseved32;
public IntPtr lpReversed32;
public IntPtr hStdInput;
public IntPtr hStdOutput;
public IntPtr hStdError;
};
public struct SECURITY_ATTRIBUTES{
public int nLength;
public IntPtr lpSecurityDescriptor;
public bool bInheritedHandle;
};
public class LowAPI{
[DllImport("kernel32.dll")]
static extern bool CreateProcessW( string lpApplicationName,
string lpCommandLine,
IntPtr lpProcessAttributes,
IntPtr lpThreadAttributes,
bool bInheritHandles,
uint dwCreationFlags,
IntPtr lpEnvironment,
string lpCurrentDirectory,
ref STARTUPINFO lpStartupInfo,
out PROCESS_INFORMATION lpProcessInformation );
};
//};
|
Main.cs:
|
C#-Quelltext
|
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
|
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
// using LowSys;
namespace Programm{
public class Test1{
public static void Main(){
STARTUPINFO sInfo = new STARTUPINFO ();
PROCESS_INFORMATION sPInfo = new PROCESS_INFORMATION ();
LowAPI.CreateProccess ("C:\\WINDOWS\\SYSTEM32\\Calc.exe",
null,
IntPtr.Zero,
IntPtr.Zero,
false,
0,
IntPtr.Zero,
null,
ref sInfo,
out sPInfo);
Console.ReadLine();
}
}
}
|
Ich kann CreateProccess nicht aufrufen, da dieses angeblich nicht vorhanden ist.
Leider habe ich keine Ahnung was ich falsch mache. ( Ich habe noch nicht gerade viel mit C# gemacht und Syntax sitzt bei mir auch noch nicht ganz richtig
)
Kann mir da jemand helfen?
Gruß Techie