Click here to Skip to main content
15,887,267 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to get the connected computer in the network Pin
akosidandan31-Dec-10 20:14
akosidandan31-Dec-10 20:14 
GeneralRe: How to get the connected computer in the network Pin
Goutam Patra31-Dec-10 20:37
professionalGoutam Patra31-Dec-10 20:37 
QuestionHello ? Pin
kanchan112331-Dec-10 18:52
kanchan112331-Dec-10 18:52 
AnswerRe: Hello ? Pin
PIEBALDconsult31-Dec-10 20:33
mvePIEBALDconsult31-Dec-10 20:33 
AnswerRe: Hello ? Pin
Goutam Patra31-Dec-10 20:40
professionalGoutam Patra31-Dec-10 20:40 
AnswerRe: Hello ? Pin
Abhinav S1-Jan-11 0:42
Abhinav S1-Jan-11 0:42 
GeneralRe: Hello ? Pin
musefan6-Jan-11 0:39
musefan6-Jan-11 0:39 
QuestionSetFilePointerEx not moving pointer Pin
Chris Copeland31-Dec-10 6:11
mveChris Copeland31-Dec-10 6:11 
Hey there,

I'm working on an NTFS Master File Table reader as part of a project for University. I've already got a Console API working in C++ which reads the current $MFT file/table, and i've begun work on porting the code over to C# (as per my requirements), however my version of SetFilePointerEx doesn't seem to move the file buffer pointer.

My C++ code:

BOOL __stdcall SetFileBlockLocation(HANDLE address, LARGE_INTEGER position)
{
	return SetFilePointerEx(address, position, NULL, FILE_BEGIN);
}


My C# code:

public bool AssignPointerPosition(Int64 position, EFileMove movement)
{
	if (this.IsBufferReady == false)
		return false;

	if (Win32API.SetFilePointerEx(this.block, (long)position, IntPtr.Zero, movement) == false)
	{
		this.errorcode = Marshal.GetLastWin32Error();
                this.errorpos = MFTHaltPosition.MoveFile;
                return false;
	}
            
	return true;
}


Where EFileMove is set to EFileMove.FileBegin (aka. 0)
When I run another ReadFile, it continues to read out the same block of data into the buffer (the first four bytes should be FILE, but instead reads the beginning of the NTFS block).

Does anyone have an idea why it wouldn't move the pointer forward (position is a value far above 0), and is there a solution?

Thank you,
Chris
AnswerRe: SetFilePointerEx not moving pointer Pin
jchoover31-Dec-10 6:30
jchoover31-Dec-10 6:30 
GeneralRe: SetFilePointerEx not moving pointer Pin
Chris Copeland31-Dec-10 6:34
mveChris Copeland31-Dec-10 6:34 
GeneralRe: SetFilePointerEx not moving pointer Pin
jchoover31-Dec-10 7:11
jchoover31-Dec-10 7:11 
GeneralRe: SetFilePointerEx not moving pointer Pin
Chris Copeland31-Dec-10 7:20
mveChris Copeland31-Dec-10 7:20 
GeneralRe: SetFilePointerEx not moving pointer Pin
jchoover31-Dec-10 7:40
jchoover31-Dec-10 7:40 
GeneralRe: SetFilePointerEx not moving pointer Pin
Chris Copeland31-Dec-10 7:51
mveChris Copeland31-Dec-10 7:51 
GeneralRe: SetFilePointerEx not moving pointer Pin
Henry Minute31-Dec-10 12:07
Henry Minute31-Dec-10 12:07 
GeneralRe: SetFilePointerEx not moving pointer [modified] Pin
Chris Copeland1-Jan-11 1:12
mveChris Copeland1-Jan-11 1:12 
AnswerRe: SetFilePointerEx not moving pointer Pin
Henry Minute31-Dec-10 7:15
Henry Minute31-Dec-10 7:15 
GeneralRe: SetFilePointerEx not moving pointer Pin
Luc Pattyn1-Jan-11 16:07
sitebuilderLuc Pattyn1-Jan-11 16:07 
GeneralRe: SetFilePointerEx not moving pointer Pin
Henry Minute2-Jan-11 5:31
Henry Minute2-Jan-11 5:31 
AnswerRe: SetFilePointerEx not moving pointer Pin
Luc Pattyn1-Jan-11 16:09
sitebuilderLuc Pattyn1-Jan-11 16:09 
QuestionC# dynamic controls Pin
Software200731-Dec-10 5:18
Software200731-Dec-10 5:18 
AnswerRe: C# dynamic controls Pin
Interflo31-Dec-10 5:40
Interflo31-Dec-10 5:40 
GeneralRe: C# dynamic controls Pin
Software200731-Dec-10 5:50
Software200731-Dec-10 5:50 
GeneralRe: C# dynamic controls Pin
Henry Minute31-Dec-10 6:09
Henry Minute31-Dec-10 6:09 
GeneralRe: C# dynamic controls Pin
Espen Harlinn1-Jan-11 8:17
professionalEspen Harlinn1-Jan-11 8:17 

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.