Click here to Skip to main content
15,900,461 members
Home / Discussions / C#
   

C#

 
GeneralRe: Creating invisible services Pin
Radgar26-Feb-05 17:26
Radgar26-Feb-05 17:26 
GeneralRe: Creating invisible services Pin
Mazdak27-Feb-05 4:50
Mazdak27-Feb-05 4:50 
GeneralRe: Creating invisible services Pin
Colin Angus Mackay27-Feb-05 7:04
Colin Angus Mackay27-Feb-05 7:04 
GeneraltextBox Pin
sardonicus26-Feb-05 12:03
sardonicus26-Feb-05 12:03 
GeneralRe: textBox Pin
S. Senthil Kumar26-Feb-05 12:44
S. Senthil Kumar26-Feb-05 12:44 
GeneralRe: textBox Pin
sardonicus27-Feb-05 3:19
sardonicus27-Feb-05 3:19 
GeneralRe: textBox Pin
S. Senthil Kumar27-Feb-05 7:16
S. Senthil Kumar27-Feb-05 7:16 
GeneralNTDll's Compression Functions Pin
Stanimir_Stoyanov26-Feb-05 11:52
Stanimir_Stoyanov26-Feb-05 11:52 
Hello,
I'm writing an application that has to have a de/compressing algorithm used to store data. The algorithm I want to use is the LZNT and its functions are exported in NtDll.Dll as far as an unofficial documentation says. I was able to find the 3 functions' syntax, but I can't get them to work. Here they are (DLLImport info stripped):

public static extern void RtlCompressBuffer(
ulong CompressionFormat,
void *SourceBuffer,
ulong SourceBufferLength,
out IntPtr DestinationBuffer,
ulong *DestinationBufferLength,
ulong Unknown,
out ulong *pDestinationSize,
void *WorkspaceBuffer );

public static extern IntPtr RtlDecompressBuffer(
out IntPtr DestinationBuffer,
ulong DestinationBufferLength,
IntPtr SourceBuffer,
ulong SourceBufferLength,
ulong *pDestinationSize );

public static extern IntPtr RtlGetCompressionWorkSpaceSize(
ulong CompressionFormat,
out ulong *pNeededBufferSize,
out ulong *pUnknown );

Please correct me if I'm wrong with them, and I'd like to see any sample code which I can use for manipulating data.

Thank you in advance, and best regards,
Stan

P.S. here is the code I tried
Stream fs = new FileStream("input.exe", FileMode.Open); //input.exe is a test file
byte[] DataIn = new byte[fs.Length];
fs.Read(DataIn, 0, (int)fs.Length);
fs.Close();
IntPtr p_DataOut;
ulong *pDS;
byte* bt = stackalloc byte[DataIn.Length];
fixed(byte *p_DataIn = DataIn)
{
RtlCompressBuffer(0x0002 /*LZNT*/, p_DataIn, (ulong)DataIn.Length, out p_DataOut, (ulong*)DataIn.Length, 0x1000, out pDS, bt);
}

I get a NullReferenceException when executing RtlCompressBuffer, but as far as I saw, none of the parameters is null, except the ones with 'out' modifiers
GeneralRe: NTDll's Compression Functions Pin
Heath Stewart27-Feb-05 4:25
protectorHeath Stewart27-Feb-05 4:25 
Generalarrange dataGrid Columns Pin
Adnan Siddiqi26-Feb-05 10:53
Adnan Siddiqi26-Feb-05 10:53 
GeneralRe: arrange dataGrid Columns Pin
Heath Stewart27-Feb-05 4:30
protectorHeath Stewart27-Feb-05 4:30 
GeneralSystem.Xml.XmlException: The root element is missing. Pin
mantissaPuc26-Feb-05 9:53
mantissaPuc26-Feb-05 9:53 
GeneralRe: System.Xml.XmlException: The root element is missing. Pin
Radgar26-Feb-05 16:59
Radgar26-Feb-05 16:59 
GeneralProblem with my DB.. Pin
Tugbay Sahin26-Feb-05 9:14
Tugbay Sahin26-Feb-05 9:14 
GeneralRe: Problem with my DB.. Pin
Colin Angus Mackay26-Feb-05 9:20
Colin Angus Mackay26-Feb-05 9:20 
GeneralRe: Problem with my DB.. Pin
Tugbay Sahin26-Feb-05 9:27
Tugbay Sahin26-Feb-05 9:27 
GeneralRe: Problem with my DB.. Pin
Colin Angus Mackay26-Feb-05 9:41
Colin Angus Mackay26-Feb-05 9:41 
GeneralRe: Problem with my DB.. Pin
Tugbay Sahin26-Feb-05 9:43
Tugbay Sahin26-Feb-05 9:43 
GeneralRe: Problem with my DB.. Pin
Rob Graham26-Feb-05 9:41
Rob Graham26-Feb-05 9:41 
Generalescaping special characters... Pin
theJazzyBrain26-Feb-05 8:51
theJazzyBrain26-Feb-05 8:51 
GeneralRe: escaping special characters... Pin
leppie26-Feb-05 9:09
leppie26-Feb-05 9:09 
GeneralRe: escaping special characters... Pin
theJazzyBrain27-Feb-05 11:26
theJazzyBrain27-Feb-05 11:26 
GeneralRe: escaping special characters... Pin
Dave Kreskowiak26-Feb-05 9:37
mveDave Kreskowiak26-Feb-05 9:37 
GeneralRe: escaping special characters... Pin
theJazzyBrain27-Feb-05 1:37
theJazzyBrain27-Feb-05 1:37 
GeneralRe: escaping special characters... Pin
Dave Kreskowiak27-Feb-05 3:12
mveDave Kreskowiak27-Feb-05 3:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.