|
Hello Darrel,
Beginning with Windows XP Service pack 2 and Windows Server 2003 Microsoft changed how you create processes with alternate credentials from the SYSTEM account. Prior to XP-SP2 it was a piece of cake. But with the new security technologies implemented its much more difficult. Microsoft has made a very weak attempt to document some of the changes for developers here:
Windows XP Service Pack 2 - Security Information for Developers[^]
But don't waste yout time looking at it, it pretty much doesn't contain anything useful. You may want to take a look at some source code instead. I found the folowing source code on the internet and thought you may want to take a look at some if its functions.
alternate credentials from the SYSTEM account[^]
Hope it helps,
-David Delaune
|
|
|
|
|
Thank you. I have setup Server 2003 and created 2 user sessions, then tried using SendMessage() to communicate between two user sessions, which does not work. I've done much more searching and read that the hWnd global but is limited to the scope of the windows station. This makes sense in terms of security reasons, but sucks when I want more flexibility. I also came across a few messages that says hWnd is "system wide", which makes me confused again. I tested Named pipes and it works because it was designed to work across networks, so it will be the last resort. It would be nice to clear up the confusion though.
|
|
|
|
|
Has anyone here ever had the need to use something faster than memcpy() to move a large amount of data in physcal memory?
I have a suspicion that memcpy is copying only a few bytes at a time, depending on what compiler is used.
Any information floating around here? (I'm also googling, and I'll update this thread if I find something..)
|
|
|
|
|
I certainly agree that the performance of memcpy is dependent on the compiler. I took a quick look at the memcpy that came with my version of Visual C++ and it looks well written. That is, it should run fast for large data blocks.
You wrote that memcpy only copies a few bytes at a time. The code I saw was using a block move instructions to do most of the work. However, we may not be looking at the same code. Which compiler are you using?
Bob
|
|
|
|
|
VS 2005 - memcpy.c
while (count--) {
*(char *)dst = *(char *)src;
dst = (char *)dst + 1;
src = (char *)src + 1;
}
definitely not a block copy. Which version do you have and can you post the relevant code?
You may be right
I may be crazy
-- Billy Joel --
Within you lies the power for good - Use it!
|
|
|
|
|
I believe he is referring to the Intel optimized memcpy located at:
Program Files\Microsoft Visual Studio 8\VC\crt\src\intel\memcpy.asm
or
Program Files\Microsoft Visual Studio 9\VC\crt\src\intel\memcpy.asm
Best Wishes,
-David Delaune
|
|
|
|
|
I have VS 2008, version 3.5. I believe that this code is copy righted so, I cannot post it. Sorry.
Bob Sherry
|
|
|
|
|
The memcpy source files are the same in both VS2005/VS2008 all service packs.
Best Wishes,
-David Delaune
|
|
|
|
|
With VS your release build will likely use the intrinsic version.
http://msdn.microsoft.com/en-us/library/26td21ds(VS.80).aspx[^]
...cmk
The idea that I can be presented with a problem, set out to logically solve it with the tools at hand, and wind up with a program that could not be legally used because someone else followed the same logical steps some years ago and filed for a patent on it is horrifying.
- John Carmack
|
|
|
|
|
Please consider the following C++ program:
#include <iostream><br />
<br />
using namespace std;<br />
<br />
class Base0 {<br />
public:<br />
Base0()<br />
{<br />
cout << "Base0::Base0() called" << endl;<br />
}<br />
~Base0()<br />
{<br />
cout << "Base0::~Base0() called" << endl;<br />
}<br />
<br />
};<br />
<br />
class Base1 {<br />
public:<br />
Base1()<br />
{<br />
cout << "Base1::Base1() called" << endl;<br />
}<br />
~Base1()<br />
{<br />
cout << "Base1::~Base1() called" << endl;<br />
}<br />
<br />
};<br />
<br />
class Base2 {<br />
public:<br />
Base2()<br />
{<br />
cout << "Base2::Base2() called" << endl;<br />
}<br />
~Base2()<br />
{<br />
cout << "Base2::~Base2() called" << endl;<br />
}<br />
<br />
};<br />
<br />
class Base3 {<br />
public:<br />
Base3()<br />
{<br />
cout << "Base3::Base3() called" << endl;<br />
}<br />
~Base3()<br />
{<br />
cout << "Base3::~Base3() called" << endl;<br />
}<br />
<br />
};<br />
<br />
class Test1 : public Base0, virtual Base1 {<br />
public:<br />
Test1()<br />
{ cout << "Test1::Test1() called" << endl; }<br />
~Test1()<br />
{ cout << "Test1::~Test1() called" << endl; }<br />
};<br />
<br />
class Test2 : public virtual Base1, Base2, Base3 {<br />
public:<br />
Test2()<br />
{ cout << "Test2::Test2() called" << endl; }<br />
~Test2()<br />
{ cout << "Test2::~Test2() called" << endl; }<br />
};<br />
<br />
<br />
class Test3 : public Test1, virtual Test2 {<br />
public:<br />
Test3()<br />
{ cout << "Test3::Test3() called" << endl; }<br />
~Test3()<br />
{ cout << "Test3::~Test3() called" << endl; }<br />
};<br />
<br />
<br />
int<br />
main()<br />
{<br />
Test3 t3;<br />
<br />
return 0;<br />
}
Before Test3 can be initialized, Test1 and Test2 must be initialized. To Initialize Test1, you have to construct its base classes. The first base class of Test1 is Base0. Therefore, I would expect that the constructor for Base0 to be the first constructor called. However, my output shows that the first construct called is Base1. I do not understand why. I am hoping that somebody can tell me why?
Thanks
Bob
|
|
|
|
|
BobInNJ wrote: I do not understand why. I am hoping that somebody can tell me why?
Try reading up about multiple inheritance.
led mike
|
|
|
|
|
Virtual keyword will be given priority when doing inheritance. In this Test3 is inherited from Test1, Test2 and test2 is executing first since its virtual inheritance.
Subbarao.
|
|
|
|
|
I have to read a file (for a string) and the file is available only at the compilation time, not in the run time.
Is there any possibility to read the file during compilation and initialize a variable with the value read from the file.
I have tried different methods, but doesn't work for me. Can anybody please tell me how can i do this?
Thanks in advance.
|
|
|
|
|
That's an interesting task. I wonder why you would need to do something like that. I can think of generally 2 things. You could try to achieve this with a pre-build step that would open your file, read out the value, then find the corresponding variable initialization in your sorce file, paste the string in it and save the modified source (i guess you would need to write a little proggie to perform this for you). Or how about insterting the file into your project as a custom resource file and then at run time load the file, read its content and then initialize your variable, of course if the content of that file keeps changing during compilation this could prove problematic. Any of these look doable? Maybe give more details about the whole concept for us to think of something.
|
|
|
|
|
thinking of writing it to .h file.
Anyways thanks for the suggestion
|
|
|
|
|
...or using environment variables ?!
|
|
|
|
|
I'm having some issues with some D3D code when trying to display 2D images. All I want is the following:
Set up D3D
Set up a viewport that is suitable for 2D drawing/rendering of images and that doesn't scale the images when the window is resized
Draw the 2D image at some x,y coord
I have some code that does all this, *but* the image quality when rendered is not as nice as OpenGL does. I'm trying to figure out if it's something I'm doing wrong, or if it's just a difference between OGL and D3D. The image is very slighty "fuzzy", as if a small amount of scaling was being performed.
The vertex struct is something like this:
struct PANELVERTEX
{
FLOAT x, y, z;
float rhw;
DWORD color;
FLOAT u, v;
};
#define D3DFVF_PANELVERTEX (D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_TEX1)
All z coords are assigned 0.0
The rest of coords for the image are assigned :
pVertices[0].x = 0.0f - 0.5f;
pVertices[0].y = 0.0f - 0.5f;
pVertices[0].u = 0.0f;
pVertices[0].v = 0.0f;
pVertices[1].x = w - 0.5f;
pVertices[1].y = 0.0f - 0.5f;
pVertices[1].u = 1.0f;
pVertices[1].v = 0.0f;
pVertices[2].x = w - 0.5f;
pVertices[2].y = h - 0.5f;
pVertices[2].u = 1.0f;
pVertices[2].v = 1.0f;
pVertices[3].x = 0.0f - 0.5f;
pVertices[3].y = h - 0.5f;
pVertices[3].u = 0.0f;
pVertices[3].v = 1.0f;
where w and h are the width and height of the image.
When I start to render stuff I use
D3DXMATRIX Identity;
D3DXMatrixOrthoLH(&Ortho2D, r.getWidth(), r.getHeight(),
0.0f, 1.0f);
D3DXMatrixIdentity(&Identity);
Where r is the client rect for the window
I then draw the vertices using a D3DPT_TRIANGLEFAN.
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
VCF Blog
|
|
|
|
|
Try setting up texture filtering modes using the SetSamplerState method (of the device). Try using bilinear or anisotropic filtering, which suits you better.
|
|
|
|
|
OK, but what I'm trying to avoid is having *any* scaling occur. If i have an image that's 400 X 400, then I would like to have it rendered at exactly 400 X 400, with no scaling.
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
VCF Blog
|
|
|
|
|
Ah, sorry, i misunderstood you, my bad. Maybe use D3DTLVERTEX, using that D3D does not perform any transformation of the vertices, so you don't need to fiddle with the transformation and projection matrices.
|
|
|
|
|
It's not a good idea to think of screen space and world|view|camera|whatever as being the same thing, they're not, even when you use 1:1 ortho projection.
Setting your ortho matrix to the same extents as the window is sufficient to set scaling to 1:1.
Everything else, filters and such, is to get proper partial pixel blending.
...cmk
The idea that I can be presented with a problem, set out to logically solve it with the tools at hand, and wind up with a program that could not be legally used because someone else followed the same logical steps some years ago and filed for a patent on it is horrifying.
- John Carmack
|
|
|
|
|
I have some directories/Folders that I placed on a zip drive to transport to another computer. When they are copied to the other computer they are "Read Only" I right-clicked on the folder, went to the properties iteem and selected it. It was set to Read Only. I changed that setting and selected sub-folders also and the progress bar began activity showing it was changing from read Only. after everything was complete I selected the "OK" buttons on all dialogs. I reselected that folder and openned the properties selection and it WAS SET TO READ ONLY again. How do you change this setting?
I also repeated all this under "Run as Administrator" but to no avail.
Help!(I'm running Vista OS on both machines)
A C++ programming language novice, but striving to learn
|
|
|
|
|
|
I have created the following class:
class variable {
public:
// The core data for a variable is an array of values
// Variable 0 will always be the error variable and
// variable 1 will always be the dependent variable.
string name;
bool isStochastic;
bool isDependent;
bool used;
bool isSeasDummy;
bool isKeeper;
double firstValue;
date firstDate;
double *values;
date *dates;
int time0;
int numTimes;
int fillRule;
bool hasLowerBound;
double lowerBound;
bool hasUpperBound;
double upperBound;
bool hasLeads;
int leads;
int lags;
bool keepAtStart;
variable() {
numTimes = -1;
used = false;
isStochastic = true;
isKeeper = false;
hasLeads = true;
};
// This constructor sets up a variable dynamically
// allocating the value and date arrays.
variable(int inTimes) {
values = new double [inTimes + 20];
dates = new date [inTimes + 20];
numTimes = inTimes;
isSeasDummy = false;
used = false;
isStochastic = true;
isKeeper = false;
keepAtStart = false;
hasLowerBound = false;
lowerBound = smallNumber;
hasUpperBound = false;
upperBound = bigNumber;
leads = 0;
lags = 0;
isDependent = false;
};
void insert(int inTime0, date inDate) {
for (time0 = numTimes; time0 > inTime0; time0--) {
values[time0] = values[time0 - 1];
dates[time0] = dates[time0 - 1];
};
dates[inTime0] = inDate;
if (fillRule == 0) {
values[time0] = 0;
};
if (fillRule == 1) {
values[time0] = values[time0 - 1];
};
if (fillRule == 2) {
values[time0] = values[time0 + 1];
};
if (fillRule == 3) {
values[time0] = (values[time0 - 1] + values[time0 + 1])/2;
};
if (fillRule == 4) {
if (values[time0 + 1] > values[time0 - 1]) {
values[time0] = values[time0 + 1];
}
else {
values[time0] = values[time0 - 1];
};
};
if (fillRule == 5) {
if (values[time0 + 1] > values[time0 - 1]) {
values[time0] = values[time0 - 1];
}
else {
values[time0] = values[time0 + 1];
};
};
numTimes++;
};
~variable() {
delete [] values;
delete [] dates;
cout << "got into variable destructor" << '\n';
};
};
Then I use the following code to create an array of variables:
variable *vars;
vars = new variable [numVars + maxInterventions + 1];
for (var0 = 0; var0 < numVars + maxInterventions + 1; var0++) {
vars[var0] = variable(completeTimes);
vars[var0].numTimes = numTimes;
};
Before I added the destructor, this code worked fine. However, now when the vars[var0] = variable(completeTimes);
statement is executed, it calls the destructor and destroys my array. Is there a way I can inhibit the use of the destructor? Or is there a way I can use the second constructor at the same time that I allocate the array?
|
|
|
|
|
Please, read the posting guidelines before posting (use the 'pre' or 'code' tags to format your code).
For your question: the problem is that when you copy your variable (by doing this: vars[var0] = variable(completeTimes); ), you create a copy of the first variable (which is a temporary one). The default behavior is that it will copy all the members as they are, so for pointers it will simply copy the address instead of allocating a new array. Thus, when the execution goes to the next line, your temporary variable (variable(completeTimes) ) gets destroyed and will delete its arrays. And as your other variable (vars[var0] ) only copied the address and not the content, these arrays are destroyed too.
In order to fix that, you have to provide a copy operator so that you can make a deep copy: you have to allocate new arrays instead of copying the address (don't forget to copy the other members too).
|
|
|
|