Click here to Skip to main content
15,905,028 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
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 
QuestionPlease help with thisBasic C Program Pin
biggiant2200027-Apr-09 5:45
biggiant2200027-Apr-09 5:45 
AnswerRe: Please help with thisBasic C Program [modified] Pin
CPallini27-Apr-09 6:38
mveCPallini27-Apr-09 6:38 
AnswerRe: Please help with thisBasic C Program Pin
David Crow27-Apr-09 8:10
David Crow27-Apr-09 8:10 
GeneralRe: Please help with thisBasic C Program Pin
CPallini27-Apr-09 10:46
mveCPallini27-Apr-09 10:46 
QuestionCHTMLEdView hides cursor Pin
William Engberts27-Apr-09 5:33
William Engberts27-Apr-09 5:33 
QuestionHow to code a math formula and pass it to a 'weird' function Pin
Episodio127-Apr-09 4:55
Episodio127-Apr-09 4:55 
AnswerRe: How to code a math formula and pass it to a 'weird' function Pin
CPallini27-Apr-09 6:31
mveCPallini27-Apr-09 6:31 
GeneralRe: How to code a math formula and pass it to a 'weird' function Pin
Episodio127-Apr-09 7:56
Episodio127-Apr-09 7:56 
GeneralRe: How to code a math formula and pass it to a 'weird' function Pin
CPallini27-Apr-09 9:25
mveCPallini27-Apr-09 9:25 

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.