Click here to Skip to main content
15,906,574 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: OLESTR Pin
George_George1-Apr-08 23:58
George_George1-Apr-08 23:58 
GeneralRe: OLESTR Pin
CPallini2-Apr-08 2:01
mveCPallini2-Apr-08 2:01 
GeneralRe: OLESTR Pin
George_George2-Apr-08 2:07
George_George2-Apr-08 2:07 
GeneralRe: OLESTR Pin
CPallini2-Apr-08 2:28
mveCPallini2-Apr-08 2:28 
GeneralRe: OLESTR Pin
George_George2-Apr-08 2:58
George_George2-Apr-08 2:58 
GeneralRe: OLESTR Pin
CPallini2-Apr-08 3:00
mveCPallini2-Apr-08 3:00 
GeneralRe: OLESTR Pin
George_George2-Apr-08 3:14
George_George2-Apr-08 3:14 
GeneralRe: OLESTR Pin
Stephen Hewitt2-Apr-08 16:24
Stephen Hewitt2-Apr-08 16:24 
Perhaps this will help:

// IsOnStack.cpp : Defines the entry point for the console application.
//
 
#include "stdafx.h"
#include <iostream>
#include <windows.h>
using namespace std;
 
bool IsOnStack(const void *pData)
{
	DWORD StackBase;
	DWORD StackLimit;
	__asm 
	{
		MOV EAX, DWORD PTR FS:[0x04]
		MOV StackBase, EAX
		MOV EAX, DWORD PTR FS:[0x08]
		MOV StackLimit, EAX
	}
 
	DWORD Address = reinterpret_cast<DWORD>(pData);
 
	return (Address >= StackLimit) && (Address < StackBase);
}
 
const char* PrintStack(const void *pData)
{
	return IsOnStack(pData) ? ": Stack" : ": Not on Stack";
}
 
int main(int argc, char* argv[])
{
	const char *pString1 = "String1";
	cout << pString1 << PrintStack(pString1) << endl;
 
	char String2[] = "String2";
	cout << String2 << PrintStack(String2) << endl;
 
	return 0;
}


Output is:
String1: Not on Stack
String2: Stack


Steve

GeneralRe: OLESTR Pin
George_George3-Apr-08 0:17
George_George3-Apr-08 0:17 
GeneralRe: OLESTR Pin
Stephen Hewitt6-Apr-08 14:58
Stephen Hewitt6-Apr-08 14:58 
GeneralRe: OLESTR Pin
George_George6-Apr-08 17:08
George_George6-Apr-08 17:08 
GeneralRe: OLESTR Pin
Hamid_RT7-Apr-08 3:42
Hamid_RT7-Apr-08 3:42 
GeneralRe: OLESTR Pin
George_George7-Apr-08 3:58
George_George7-Apr-08 3:58 
GeneralRe: OLESTR Pin
Hamid_RT7-Apr-08 4:12
Hamid_RT7-Apr-08 4:12 
GeneralRe: OLESTR Pin
George_George7-Apr-08 4:16
George_George7-Apr-08 4:16 
GeneralRe: OLESTR Pin
Hamid_RT7-Apr-08 4:28
Hamid_RT7-Apr-08 4:28 
Generalstatic library in two modules Pin
code_discuss1-Apr-08 20:10
code_discuss1-Apr-08 20:10 
QuestionRe: static library in two modules Pin
Rajkumar R1-Apr-08 22:47
Rajkumar R1-Apr-08 22:47 
GeneralRe: static library in two modules Pin
code_discuss2-Apr-08 14:44
code_discuss2-Apr-08 14:44 
GeneralRe: static library in two modules Pin
Mark Salsbery2-Apr-08 6:24
Mark Salsbery2-Apr-08 6:24 
GeneralEditor Pin
suhi1-Apr-08 20:02
suhi1-Apr-08 20:02 
GeneralRe: Editor Pin
Cedric Moonen1-Apr-08 21:47
Cedric Moonen1-Apr-08 21:47 
GeneralRe: Editor Pin
Hamid_RT7-Apr-08 3:49
Hamid_RT7-Apr-08 3:49 
QuestionMFC application For Tablet PC Pin
SSanket1-Apr-08 19:19
SSanket1-Apr-08 19:19 
GeneralRe: MFC application For Tablet PC Pin
rp_suman1-Apr-08 22:24
rp_suman1-Apr-08 22:24 

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.