Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
S

Snoepie

@Snoepie
About
Posts
9
Topics
2
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • WriteProcessMemory error 5
    S Snoepie

    :~ found it: Microsoft Windows Vista and later. When a message is blocked by UIPI the last error, retrieved with GetLastError, is set to 5 (access denied). took me a full week to discover this tidbit. Tnx MS

    C / C++ / MFC performance help

  • WriteProcessMemory error 5
    S Snoepie

    tnx for the input, but the original code is spiked with GetLastErrors, took some out to shorten code for viewing.

    C / C++ / MFC performance help

  • WriteProcessMemory error 5
    S Snoepie

    the call doesn't complete..... The bytecount written is correct, but the memory addressed by the call stays empty. Also in MSDN is stated that a Write call my fail whilst still returning no fail error code. After doing a sendmessage LVM_GetItemState to listView, the call returns empty as well. So the memory location seems to be inacessible, which is bizarre because i also have this: lvi.pszText=_item; WriteProcessMemory(lView, _lvi, &lvi, sizeof(LVITEM), NULL); SendMessage(listView, LVM_GETITEMTEXT, NULL, (LPARAM)_lvi); ReadProcessMemory(lView, _item, item, 512, NULL); and that returns with the correct itemtext......

    C / C++ / MFC performance help

  • WriteProcessMemory error 5
    S Snoepie

    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.

    C / C++ / MFC performance help

  • setting active audio output vista [modified]
    S Snoepie

    bingo! needed just a fresh eye. Been at it for more then a week now. Started with directx to find out the obvious and finally hooked up with this kludge. Works fine now. I'll upload the finished code when done as an addition to the XP version. Added commandline switches for toggling

    C / C++ / MFC com question

  • setting active audio output vista [modified]
    S Snoepie

    updated source code. same effect unfortunately :mad:

    C / C++ / MFC com question

  • setting active audio output vista [modified]
    S Snoepie

    blindingly obvious stupid mistake on my part.:~ Read over it a 1000 times. Stupid me, tnx. It's just so enormously frustrating to get a simple task done i've lost track

    C / C++ / MFC com question

  • setting active audio output vista [modified]
    S Snoepie

    Tnx for the input, i've already given up on using the Directx SDK. That's why i took the workaround, by calling the sound applet and just manipulating the message queue. I want to toggle the Realtek HD Audio between the speaker and digital output by code. Just read the itemstrings, see if they have a image state mask and move the cursor to the other one and push the setdefault button. The kludge given by http://www.codeproject.com/Members/odlumb for xp works in xp, just under vista the applet doesn't respond

    C / C++ / MFC com question

  • setting active audio output vista [modified]
    S Snoepie

    :confused: i am trying to adapt http://www.codeproject.com/KB/system/AudioConfigurationManager.aspx to work under vista sp2. Having it all running except for the interaction with the applet's button's using i can't get it to supply me with information. This code part gives me a headache: ZeroMemory(&lvItem,sizeof(LVITEM)); ZeroMemory(&lState,0,sizeof(LVITEM)); ZeroMemory(&item,512); defaultButton = handAcq->findChildWindow(appletWindow,BUTTON,DEFAULT_BUTTON); listView = handAcq->findChildWindow(appletWindow,COMBO_BOX,NULL); GetWindowThreadProcessId(listView,&procID); HANDLE lView=OpenProcess(PROCESS_VM_OPERATION|PROCESS_VM_READ|PROCESS_VM_WRITE|PROCESS_QUERY_INFORMATION,false,procID); if (lView) { LVITEM *_lvi=(LVITEM*)VirtualAllocEx(lView, NULL, sizeof(LVITEM),MEM_COMMIT, PAGE_READWRITE); char *_item=(char*)VirtualAllocEx(lView, NULL, 512, MEM_COMMIT, PAGE_READWRITE); lvi.cchTextMax=512; lvi.pszText=_item; _lvi->stateMask= (UINT)-1; _lvi->mask=LVIF_STATE; if (applyButton && defaultButton) //found buttons { // THIS DOESN'T WORK, RETURNS AN EMPTY lvitem STRUCTURE SendMessage(listView, LVM_GETITEMSTATE, (WPARAM)0, (LPARAM)_lvi); ReadProcessMemory(lView, _lvi, &lState, sizeof(LVITEM), NULL); // THIS WORKS AND RETURNS THE ITEM NAMES SendMessage(listView, LVM_GETITEMTEXT, (WPARAM)0, (LPARAM)_lvi); ReadProcessMemory(lView, _item, item, 512, NULL); } There are no errors, just ignores any interaction with the applet other then retrieving strings. What am i doing wrong?

    modified on Saturday, April 25, 2009 9:02 AM

    C / C++ / MFC com question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups