Click here to Skip to main content
15,891,692 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Reading sectors Pin
Victor Nijegorodov9-May-20 22:57
Victor Nijegorodov9-May-20 22:57 
GeneralRe: Reading sectors Pin
Richard MacCutchan9-May-20 23:31
mveRichard MacCutchan9-May-20 23:31 
GeneralRe: Reading sectors Pin
_Flaviu10-May-20 0:24
_Flaviu10-May-20 0:24 
GeneralRe: Reading sectors Pin
_Flaviu10-May-20 0:27
_Flaviu10-May-20 0:27 
GeneralRe: Reading sectors Pin
Victor Nijegorodov10-May-20 0:54
Victor Nijegorodov10-May-20 0:54 
GeneralRe: Reading sectors Pin
Richard MacCutchan10-May-20 1:32
mveRichard MacCutchan10-May-20 1:32 
GeneralRe: Reading sectors Pin
_Flaviu10-May-20 2:09
_Flaviu10-May-20 2:09 
AnswerRe: Reading sectors Pin
«_Superman_»9-May-20 19:46
professional«_Superman_»9-May-20 19:46 
As others have pointed out, the issue is with pBuffer not associated with any allocated memory.
In addition to this, I would like to point out one more flaw in your code, although it doesn't matter in this case.

The third parameter to SetFilePointer[^] must be an address of a LONG variable.
PLONG does not declare a LONG variable. It's only a pointer to a LONG variable.
Here SetFilePointer will actually try to write to memory 0.

What you need to do is declare a LONG variable and provide its address -
LONG highValue; SetFilePointer(..., ..., &highValue, ...);
You can also pass a nullptr, if you're not intersted in that value.
«_Superman 
I love work. It gives me something to do between weekends.


Microsoft MVP (Visual C++) (October 2009 - September 2013)

Polymorphism in C

GeneralRe: Reading sectors Pin
_Flaviu9-May-20 20:01
_Flaviu9-May-20 20:01 
GeneralRe: Reading sectors Pin
Richard MacCutchan9-May-20 21:36
mveRichard MacCutchan9-May-20 21:36 
GeneralRe: Reading sectors Pin
_Flaviu9-May-20 22:01
_Flaviu9-May-20 22:01 
Questionasign to return value Pin
Calin Negru2-May-20 21:55
Calin Negru2-May-20 21:55 
AnswerRe: asign to return value Pin
Richard MacCutchan2-May-20 22:11
mveRichard MacCutchan2-May-20 22:11 
AnswerRe: asign to return value Pin
Stephane Capo2-May-20 22:19
professionalStephane Capo2-May-20 22:19 
GeneralRe: asign to return value Pin
Calin Negru2-May-20 22:50
Calin Negru2-May-20 22:50 
GeneralRe: asign to return value Pin
Stephane Capo2-May-20 23:03
professionalStephane Capo2-May-20 23:03 
GeneralRe: asign to return value Pin
Calin Negru2-May-20 23:13
Calin Negru2-May-20 23:13 
GeneralRe: asign to return value Pin
Stephane Capo2-May-20 23:51
professionalStephane Capo2-May-20 23:51 
GeneralRe: asign to return value Pin
Richard MacCutchan2-May-20 23:21
mveRichard MacCutchan2-May-20 23:21 
GeneralRe: asign to return value Pin
Calin Negru2-May-20 23:35
Calin Negru2-May-20 23:35 
GeneralRe: asign to return value Pin
Richard MacCutchan2-May-20 23:48
mveRichard MacCutchan2-May-20 23:48 
GeneralRe: asign to return value Pin
Calin Negru3-May-20 0:00
Calin Negru3-May-20 0:00 
GeneralRe: asign to return value Pin
Richard MacCutchan3-May-20 0:07
mveRichard MacCutchan3-May-20 0:07 
GeneralRe: asign to return value Pin
«_Superman_»9-May-20 20:01
professional«_Superman_»9-May-20 20:01 
AnswerRe: asign to return value Pin
Calin Negru3-May-20 3:26
Calin Negru3-May-20 3:26 

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.