|
Sori, i need to go to sleep. Will discuss tmrow then.
Good night.
|
|
|
|
|
Hi David. With reference to yday's question,how is it possible to link process_checksum enabled by ASLR in Visual Studio 2010 to the command prompt?
Example:
c:Users\User\Documents\Visual Studio 2010\Projects\process_checksum\Debug>process_checksum.exe
Appreciate it very much.
Giggsey
|
|
|
|
|
Giggsey,
I am having trouble comprehending the question you are asking. Don't worry... I know that English is not your mother tongue. Your original question appears to be gibberish. Could you be more specific?
The problem is that the acronym 'ASLR' is security related... pertaining to randomization of DLL base addresses and stack/heap allocation randomizations to help mitigate aurora attacks (heap-spraying) and ROP shell code.
Are you asking how to enable ASLR in your project? If so... you would want to enable /DYNAMICBASE[^]
Best Wishes,
-David Delaune
|
|
|
|
|
Hi. Actually I am a novice to computing.
BTW, I got the cmd line from other sources.
c:Users\User\Documents\Visual Studio 2010\Projects\process_checksum\Debug>process_checksum.exe
By right, if u run the cmd, it will prompt u to enter PID.
Then the following data will be generated:
Name, Path, Image Base, PE Signature,...., and finally hash/checksum value which i'm so desperately looking for.
I have difficulty in finding/linking(whatever) this process_checksum. Bcoz in the end I would be able get the hash or checksum value of the file. That's all.
Many thanks.
Giggsey
|
|
|
|
|
Giggsey,
No problem. I completely understand that you are a novice and looking for guidance. It sounds to me as if you need to do quite a bit more research so that you can build a more complete understanding of these topics.
If you are looking to understand more about the PE hash algorithm then you should have a look at the article: An Analysis of the Windows PE Checksum Algorithm[^].
If you want to list the characteristics of arbitrary PE images (executable files) then have a look at the article: XPEInfo - a non-MFC class to get info from PE file[^].
I understand that you are working with a particular Visual Studio project named process_checksum. If you are having trouble compiling the application feel free to describe the exact details of the problem you are having.
I still do not understand the details of your problem. I suspect that it is because you do not know the verbiage to properly form the question.
Best Wishes,
-David Delaune
|
|
|
|
|
Hi David.
Yeah, u r right. I have problem in compiling the application especially. I had read the articles but still a bit confused.
So, what should I be doing then? Can u shed some light into this?
Appreciate it very much.
Giggsey
|
|
|
|
|
Giggsey73 wrote: Yeah, u r right. I have problem in compiling the application especially. I had read the articles but still a bit confused.
So, what should I be doing then? Can u shed some light into this?
No, I cannot help you without knowing the problem. If you are receiving a compilation or linking error then you should paste the error message here.
Best Wishes,
-David Delaune
|
|
|
|
|
I need to create a process_checksum.exe first before I can compile.
How do i go about creating it?
Regards,
Giggesy
|
|
|
|
|
Giggsey73 wrote: I need to create a process_checksum.exe first before I can compile.
<layer>How do i go about creating it?
Giggesy,
I am sorry but I can no longer help you. You continue to give paradoxical statements that are without a clear meaning.
Good luck with your project.
Best Wishes,
-David Delaune
|
|
|
|
|
Hi!
Is it possible to write a program with out main() function in C++?
If yes, Erom where the execution begins for such a program?
|
|
|
|
|
Yes, you can by using the Linker /ENTRY[^] option. However, you will not have the full C library initialised so it is your program's responsibility to set the environment correctly.
|
|
|
|
|
Richard MacCutchan wrote:
using the Linker /ENTRY[^]
I checked the project property pages. It's also empty. From where it comes?
|
|
|
|
|
Go to the Linker section, click on Advanced, and add your start label name to the Entry Point item.
|
|
|
|
|
In standard C++ it isn't possible.
As Richard mentioned you can specify an entry point for MSVC and other linkers allow you to do the same thing but you'll have a few hurdles to jump:
- The parameters to whatever function you define as the entry point will probably not be argc and argv
- Depending on the start-up code you're avoiding static and global objects may not be initialised (no great loss though)
- The language runtime library, even if linked, probably won't be initialised
- Anything that relies on the OS interacting with the language might go screwy (e.g. if new/delete expects allocations to come out of a heap the runtime allocates on start-up)
About the only place I've used this trick, had it work and be useful was back programming for Windows 3.1 when I was trying to keep the size of code down to a minimum and I was willing to pay the price for having an emasculated language. Basically if you're happy programming in assembler and using the OS and your own code for everything then then it may have some use.
|
|
|
|
|
Hi Mr. Univoter, any chance you can tell me why you voted me down? This is so I can either/or:
- improve my answer and perhaps leaarn how to express myself better next time
- learn something
- disagree with you and say why and let other people make up their mind
I don't do tit for tat univoting so don't let that stand in your way!
Ash
|
|
|
|
|
Hello All,
I have a hang dump from client. But the corresponding pdb are not available as it is a legacy project.
Is it possible to know whether my components are responsible for this hang without pdb's.
Thanks in advance.
|
|
|
|
|
It is possible, but without the PDB file, you will have to deal with memory addresses instead of symbols during analysis.
It would take more time and patience, but it is definitely possible.
All the best.
|
|
|
|
|
Hi,
is there any good tutorial on how to analyze hang dump when there is no PDB. I googled but failed to get good one.
Thanks for your help
|
|
|
|
|
To a certain extent, yes.
You need to set windbg to use Microsofts public symbol server, look in Windbg Help for symsrv.
this will suck down pdbs for all MS components leaving yours and third party ones. Hopefully, you can see in the stack where your code is calling into MS code and therefore what part is hanging.
of course you should archive all pdb files with the built exes.
==============================
Nothing to say.
|
|
|
|
|
#include <iostream>
#include <stdlib.h>
#include<ctime>
using namespace std;
void makebg(char**&);
bool Is(int ,int );
void cmaze(int,int);
void count(int,int);
int M=0;
int N=0;
int in=0;
int out=0;
char **maze;
int c=0;
int *cti;
int *ctj;
int dir =1;
int main()
{
cin>>M>>N;
maze =new char*[M];
for(int i=0;i<M;i++)
maze[i]=new char[N];
cti =new int[M*N];
ctj =new int[M*N];
for(int i=0;i<M*N;i++)
{
cti[i]=0;
ctj[i]=0;
}
makebg(maze);
return 0;
}
void makebg(char **&maze)
{
int i,j;
for(i=0;i <M;i++)
for(j=0;j <N;j++)
maze[i][j]='#';
srand((unsigned)time(0));
in=rand()%(M-2)+1; maze[in][0]='.';
out=rand()%(M-2)+1;
cti[0]=in;
ctj[0]=1;
cmaze(in,1);
}
void cmaze(int i,int j){
int ran=rand()%4;
if((i==out&&j==N-2)) {
maze[i][j]='.';
maze[i][j+1]='.';
}
if(maze[out][N-1]=='.')
return;
else{
maze[i][j]='.';
for (int s=0;s<M;s++)
{
for (int t=0;t<N;t++)
cout<<maze[s][t]<<' ';
cout<<'\n';
}
switch(ran)
{
case 0:{
if(Is(i+2,j)&&Is(i+1,j-1)&&Is(i+2,j+1)){ i++;
count(i,j);
dir=2;
}
else if(i+1==M-1) { c--;
i=cti[c];
j=ctj[c];
cti[c+1]=0;
ctj[c+1]=0;
}
break;
}
case 1:{ if(Is(i,j-2)&&Is(i+1,j-1)&&Is(i-1,j-1)){
j--;
count(i,j);
dir=3;
}
else if(j-1==0){
c--;
i=cti[c];
j=ctj[c];
cti[c+1]=0;
ctj[c+1]=0;
}
break;
}
case 2:{ if(Is(i-2,j)&&Is(i-1,j-1)&&Is(i-1,j+1)){
i--;
count(i,j);
dir=0;
}
else if(i-1==0){
c--;
i=cti[c];
j=ctj[c];
cti[c+1]=0;
ctj[c+1]=0;
}
break;
}
case 3:{ if(Is(i,j+2)&&Is(i-1,j+1)&&Is(i+1,j+1)){
j++;
count(i,j);
dir=1;
}
else if(j+1==N-1){
c--;
i=cti[c];
j=ctj[c];
cti[c+1]=0;
ctj[c+1]=0;
}
break;
}
}
dir=ran;
cmaze(i,j);
}
}
void count(int i,int j)
{
c++; cti[c]=i; ctj[c]=j;
}
bool Is(int i,int j)
{
if(i>=0&&i<=M-1&&j>=0&&j<=N-1&&maze[i][j]=='#')
return true;
else
return false;
}
what's the problem of my code?? can't create the maze.
may be problem comes from back to previous step,but how to correct it?
|
|
|
|
|
jiuyejii wrote: what's the problem of my code??
what happens when you run it?
|
|
|
|
|
the error : stack overfow ,or can not return to the previous step so can't find the exit
|
|
|
|
|
jiuyejii wrote: what's the problem of my code?? can't create the maze. may be problem comes from back to previous step,but how to correct it? You seriously need to learn to use the debugger to help solve such problems. Dumping a boatload of code in a forum and asking others to wade through it will get you nowhere.
Instead of trying to solve the problem as a whole, break it down into smaller chunks. If stack space is being exhausted, you most likely have a recursion problem.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
did you debug with a small maze size?
do you check array boundaries ? (for example in function count ).
You should try to convert the recursion to a iterative (loop); it might help fix the stack overflow.
Watched code never compiles.
|
|
|
|
|
No idea what's causing your stack overflow, but as one of the previous posters mentioned (think it was David, sorry if I've got that wrong) it's probably related to recursion.
As to what the problem is with your code I can sum that up in one word. Abstraction. There's not a lot is there? When you write huge lumps of code how are other people meant to follow what you mean? Come to think of it how are you supposed to be able to follow it next week? And if you and other people are having problems think of the poor, literal minded compiler, he's having a nightmare [1].
So even if you don't want to do the whole OO thing, think about splitting your code up into nice little packets you and the rest of the world can understand. Here are some guidelines which have served me well:
- make each function only do one thing but make it do it well
- split loops and complex conditionals out into their own functions
- if a variable name is only a couple of characters long it's almost always too short
- if you've got more than 2 levels of indirection in an expression then that's too much. If you've got 2 it's probably still too much. Things like char **& are right out
- even if you're programming in "C like" C++ don't play about with memory directly. Let someone else do the heavy lifting. std::vector, std::unique_ptr and std::shared_ptr can cover about 99% of your dynamic memory requirements.
Interestingly you've got one complex conditional in it's own function. Cool! Keep that up and look for other places you can do the same sort of thing. FREX you've got the following segment of code:
c--;
i=cti[c];
j=ctj[c];
cti[c+1]=0;
ctj[c+1]=0; in four places. Think of a name to describe what this lot is up to and pack it away in a function. Do that a few more times and you might be starting to see where your code is going wrong.
[1] I've committed a cardinal sin here, I've anthropomorphised a computer. They don't like it when you do that.
|
|
|
|