Click here to Skip to main content
15,893,190 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionsscanf: cannot convert parameter 1 'LPTSTR' to 'const char *' Pin
xzing27-Apr-09 13:37
xzing27-Apr-09 13:37 
AnswerRe: sscanf: cannot convert parameter 1 'LPTSTR' to 'const char *' Pin
Stuart Dootson27-Apr-09 13:49
professionalStuart Dootson27-Apr-09 13:49 
AnswerRe: sscanf: cannot convert parameter 1 'LPTSTR' to 'const char *' Pin
CPallini27-Apr-09 22:05
mveCPallini27-Apr-09 22:05 
QuestionDoc-View vs Dialog-based app - Menu Item updates Pin
john john mackey27-Apr-09 11:35
john john mackey27-Apr-09 11:35 
AnswerRe: Doc-View vs Dialog-based app - Menu Item updates Pin
led mike27-Apr-09 11:47
led mike27-Apr-09 11:47 
GeneralRe: Doc-View vs Dialog-based app - Menu Item updates Pin
john john mackey27-Apr-09 12:08
john john mackey27-Apr-09 12:08 
QuestionCalculating the Size of Rich Edit "bottomless" control Pin
ForNow27-Apr-09 9:00
ForNow27-Apr-09 9:00 
AnswerRe: Calculating the Size of Rich Edit "bottomless" control Pin
Stuart Dootson27-Apr-09 14:02
professionalStuart Dootson27-Apr-09 14:02 
GeneralRe: Calculating the Size of Rich Edit "bottomless" control Pin
ForNow27-Apr-09 16:37
ForNow27-Apr-09 16:37 
GeneralRe: Calculating the Size of Rich Edit "bottomless" control Pin
Stuart Dootson28-Apr-09 5:12
professionalStuart Dootson28-Apr-09 5:12 
GeneralRe: Calculating the Size of Rich Edit "bottomless" control Pin
ForNow28-Apr-09 9:10
ForNow28-Apr-09 9:10 
GeneralRe: Calculating the Size of Rich Edit "bottomless" control Pin
Stuart Dootson28-Apr-09 10:51
professionalStuart Dootson28-Apr-09 10:51 
GeneralRe: Calculating the Size of Rich Edit "bottomless" control Pin
ForNow28-Apr-09 11:17
ForNow28-Apr-09 11:17 
GeneralRe: Calculating the Size of Rich Edit "bottomless" control Pin
ForNow28-Apr-09 18:20
ForNow28-Apr-09 18:20 
GeneralRe: Calculating the Size of Rich Edit "bottomless" control Pin
Stuart Dootson28-Apr-09 18:58
professionalStuart Dootson28-Apr-09 18:58 
GeneralRe: Calculating the Size of Rich Edit "bottomless" control Pin
ForNow28-Apr-09 22:47
ForNow28-Apr-09 22:47 
QuestionWriteProcessMemory error 5 Pin
Snoepie27-Apr-09 6:48
Snoepie27-Apr-09 6:48 
Dead | X|
when excuting this (procID is a control panel applet)

HANDLE lView=OpenProcess(PROCESS_ALL_ACCESS,false,procID);
if (lView)
{
if ( !LookupPrivilegeValue(NULL,SE_DEBUG_NAME,&tokenLuid ) )
j=GetLastError();
tokenPriv.PrivilegeCount = 1;
tokenPriv.Privileges[0].Luid = tokenLuid;
tokenPriv.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
tokenHandle=NULL;
if (!OpenProcessToken(lView,TOKEN_ADJUST_PRIVILEGES,&tokenHandle))
j=GetLastError();

if ( !AdjustTokenPrivileges(tokenHandle,FALSE,&tokenPriv,sizeof(TOKEN_PRIVILEGES) , (PTOKEN_PRIVILEGES) NULL, (PDWORD) NULL) )
j=GetLastError();

// Allocate virtual memory for ListView
LVITEM *_lvi=(LVITEM*)VirtualAllocEx(lView, NULL, sizeof(LVITEM),MEM_COMMIT, PAGE_READWRITE);
if (!VirtualQueryEx(lView,_lvi,&memBasicInfo,sizeof(MEMORY_BASIC_INFORMATION)))
j=GetLastError();

no errors are triggered, memBasicInfo returns the correct parameters, ie i have full access to the allocated memory. But if i follow it up by:

if (WriteProcessMemory(lView, _lvi, &lvi, sizeof(LVITEM),&byteCount))
j=GetLastError();

i still get error 5, but bytecount gives the correct count. I disabled the antivirus scanner, so it's not interfering

I am flabbergasted.
QuestionRe: WriteProcessMemory error 5 Pin
CPallini27-Apr-09 7:13
mveCPallini27-Apr-09 7:13 
AnswerRe: WriteProcessMemory error 5 Pin
Snoepie27-Apr-09 8:28
Snoepie27-Apr-09 8:28 
AnswerRe: WriteProcessMemory error 5 Pin
Luc Pattyn27-Apr-09 8:17
sitebuilderLuc Pattyn27-Apr-09 8:17 
GeneralRe: WriteProcessMemory error 5 Pin
Snoepie27-Apr-09 8:29
Snoepie27-Apr-09 8:29 
GeneralRe: WriteProcessMemory error 5 Pin
Luc Pattyn27-Apr-09 8:50
sitebuilderLuc Pattyn27-Apr-09 8:50 
GeneralRe: WriteProcessMemory error 5 Pin
CPallini27-Apr-09 22:36
mveCPallini27-Apr-09 22:36 
RantRe: WriteProcessMemory error 5 Pin
Snoepie29-Apr-09 5:50
Snoepie29-Apr-09 5:50 
GeneralRe: WriteProcessMemory error 5 Pin
CPallini29-Apr-09 6:33
mveCPallini29-Apr-09 6:33 

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.