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
J

JackPuppy

@JackPuppy
About
Posts
40
Topics
11
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Writing compiler, got obfuscator?
    J JackPuppy

    gesus! writting a complier must be a difficult job!

    Clever Code question csharp c++ dotnet graphics

  • I find an interesting and confusing code..have a look.
    J JackPuppy

    thanks for advising. i didn't know it.

    C / C++ / MFC question

  • I find an interesting and confusing code..have a look.
    J JackPuppy

    OK,let me expain:

    fun(){
    int temp;
    throw temp;
    }

    void fun1(){
    try{
    int a;
    fun();
    int* p=null;
    p=new int[40]

    }
    catch(int temp){
    delete[] p;

    }
    }

    main(){
    fun1();
    }

    when main() call fun1(), a,p are push into stack without initialize. fun()throw an exception so the try-catch block detect it. and the program jump into catch{} and in the catch{} it delete[] p; wait for a sec, p wasn't initialize yet so this is wrong; however how can we determine whether p was initialize? because when p was pushed into stack it contain some data and become a dangling pointer. by convention, we will write catch{ if(p!=NULL) delete[] p; } but it wasn't the case at this circumstance because p is not null at the very begining! of cause you can write like this: int* p=null; fun(); p=new int[40]; so p is null before calling fun(). so It's OK now. I find this interesting because I have to pay so much programing knowledge to explain this small mistake, the knowledge concerned are : stack, heap management, PE format, linker, loader, lib.

    C / C++ / MFC question

  • I find an interesting and confusing code..have a look.
    J JackPuppy

    lol.... you make me largh! Please look into this code because it's not that simple and it contain some deadly fallacies in it! And not just one, many! My confusion is that I don't find a way out to solve it.

    C / C++ / MFC question

  • I find an interesting and confusing code..have a look.
    J JackPuppy

    fun(){
    int temp;
    throw temp;
    }

    void fun1(){
    try{
    int a;
    fun();
    int* p=null;
    p=new int[40]

    }
    catch(int temp){
    delete[] p;

    }
    }

    main(){
    fun1();
    }

    I write some code that supposed to make you understand, rather than make it perfect without any mistakes. Alas, just edit a bit can make it compliable.

    C / C++ / MFC question

  • I find an interesting and confusing code..have a look.
    J JackPuppy

    fun(){
    int temp;
    throw temp;
    }

    main(){
    void fun1(){
    try{
    int a;
    fun();
    int* p=null;
    p=new int[40]

    }
    catch(int temp){
    delete[] p;

    }
    }
    }

    What will hapen?

    C / C++ / MFC question

  • What is contained in lib?
    J JackPuppy

    thanks! why lib is smaller than dll? if lib is the combination of all objects, and dll also a combination of all objects(some have been allocated though), dll should be greater in size than lib. And are you saying import liberay and static program liberary are exactly the same?

    C / C++ / MFC question

  • What is contained in lib?
    J JackPuppy

    thanks! why lib is smaller than dll? if lib is the combination of all objects, and dll also a combination of all objects(some have been allocated though), dll should be equal of smaller in size than lib. And are you saying import liberay and static program liberary are exactly the same?

    C / C++ / MFC question

  • What is contained in lib?
    J JackPuppy

    What's the difference between import liberary and static program liberary, they seems to have the same suffix(.lib)? Can somebody provide me the explicit demonstration of lib file. BTW, i have learnt PE format already.

    C / C++ / MFC question

  • My second time to design a website...
    J JackPuppy

    if you are referring the Heap Management problem yes if "CRT runtime error, must terminate the application" then no, alas.

    C / C++ / MFC csharp html asp-net com design

  • My second time to design a website...
    J JackPuppy

    Thanks, obvious it's no my cup of tee. btw, i have another book that was publiched by O'lley, is extreme good. But i need a full view of designing and publicizing of a web site. Thanks, though.

    C / C++ / MFC csharp html asp-net com design

  • My second time to design a website...
    J JackPuppy

    It will be my second time to design a website. Last time I use C# and ASP.net all I do in my teem is writing event manipulation C# code begind every important component(such as buttons, textbox, etc..). I know little a bout what happens after a user send a get message( which looks like: GET www.dodd.com/dkdlf.html HTTP 1.1/r/n.....) and how this data is transfered and maninulated by what? What's the relationship between Server II and C#code and ASP.net code. I really don't know nothing about this and I need a book that can at least demonstrate these things in a clear way. Can someone provide a book fulled my demands? It will be greatly appreciated because I really want to make myself clear at what i'm doing. Thanks! Jack

    C / C++ / MFC csharp html asp-net com design

  • A tricky way of manipulating memory allocation [modified]
    J JackPuppy

    Shall we talk on MSN? my MSN is dingxiaofenguni@gmail.com

    C / C++ / MFC c++ performance question discussion announcement

  • A tricky way of manipulating memory allocation [modified]
    J JackPuppy

    "A heap descriptor"? you mean "heap structures"? which contain Freelists, Lookaside Lists and the like and which reside in the front of A heap? Does CRT change the content of heap descriptor directorly or it was edited while inside RltHeapAllocate or RltFreeHeap? It seems to me the latter one is safer and more reasonable. The second question, yes, the debug and release version does contain different info of heap, because debug version want to provide more info such as heap memory leak, heap memory overflows, etc. What's the main differneces between each release versions? I discover one, which you can see in page 32 in XPSP2 Heap Exploitation.ppt( you can find this on internet, or i can send you by email) And I want to make sure that: chances are that when one copy of CRT is mapped to process memory address in DLLMain(), its own heap can be initialized. Can this happens because I saw this opinion in some articles. But you are saying there are only one heap-the default heap for each version of CRT to malloc and free. Are you sure with what you are saying?

    C / C++ / MFC c++ performance question discussion announcement

  • A tricky way of manipulating memory allocation [modified]
    J JackPuppy

    you can see: Dynamic Memory Management.ppt for more info.

    C / C++ / MFC c++ performance question discussion announcement

  • A tricky way of manipulating memory allocation [modified]
    J JackPuppy

    I read a lot of arctiles in heap management these days. you can goole "free lists lookaside table filetype:ppt" and there a bunch of useful infomation. I find a serious problem: 1.all mallocs and frees in different versions of CRT of Windows call the same RtlAllocateHeap(), and RtlFreeHeap(), and all infomation needed by RtlAllocateHeap,and AtlFreeHeap() was builded by ntoskrnl.exe. It seems to me that malloc and free don't need to interact with CRT. What specific info is contained in CRT, rather than process management field(PEB or sth.)?

    C / C++ / MFC c++ performance question discussion announcement

  • "The application has requested the Runtime to terminate it in an unusual way" CRT error??
    J JackPuppy

    Yes, please. BTW, I dumpBin my exe, and my application doesn't use MFC42u.dll, nor does it run on W Server 2003.

    C / C++ / MFC help question com announcement

  • "The application has requested the Runtime to terminate it in an unusual way" CRT error??
    J JackPuppy

    #include <<windows.h>> #include <<iostream>> #include <<winsock2.h>> #include <<ws2tcpip.h>> #include <<vector>>

    C / C++ / MFC help question com announcement

  • "The application has requested the Runtime to terminate it in an unusual way" CRT error??
    J JackPuppy

    #include "stdafx.h"

    #include
    #include
    #include
    #include
    #include

    ///////////////////have to installed boost liberay at first
    #include <boost/regex.hpp>
    #include <boost/lambda/lambda.hpp>
    using namespace std;
    using namespace boost;

    #pragma comment(lib, "ws2_32.lib ")

    WSAData Wsadata;
    WORD wVersion;

    //////////this structure is used for grab specific infomation of one page
    struct DOC{
    string pcClass;
    string pcNm;
    string pcNmWb;
    string pcDocNm;
    string pcDocWb;
    string pcDy;
    string pcHr;
    string pcRpDy;
    string pcRpHr;
    string pcRead;
    string pcRpCn;
    };

    HANDLE hSemaThr,hCont,hSema;
    int CanThr;

    int GetHostName(const string& HttpHead,string& hostname);
    int BuildRequest(string& HttpRequest ,const string& url);
    ///
    ///connect the client to the host
    ///
    int ConnectClient(const string& hostname,SOCKET& client)
    {

    char\* ip = new char\[hostname.size()+1\];
    memset(ip,0,hostname.size()+1);
    strcpy(ip,hostname.c\_str());
    char\* port = "80";
    struct addrinfo aiHints;
    struct addrinfo \*aiList = NULL;
    int retVal;
    
    memset(&aiHints, 0, sizeof(aiHints));
    aiHints.ai\_family = AF\_INET;
    aiHints.ai\_socktype = SOCK\_STREAM;
    aiHints.ai\_protocol = IPPROTO\_TCP;
    
    if ((retVal = getaddrinfo(ip, port, &aiHints, &aiList)) != 0) {
    	cout<<"getaddrinfo() failed.\\n"<<GetLastError();
    	return 0;
    }
    else if(connect(client,(sockaddr\*)aiList->ai\_addr,sizeof(\*aiList->ai\_addr))==SOCKET\_ERROR){
    	cout<<"connect error"<<WSAGetLastError()<<endl;
    
    	WSACleanup();
    	return 0;
    }
    else return 1;
    

    }
    ///
    ///send buf and return a vector
    ///
    int SendRecive(const string& request,SOCKET& client,string& answer)
    {

    answer.clear();
    string HostName;
    if(!GetHostName(request,HostName))
    {
    	return 0;
    }
    if(!ConnectClient(HostName,client))
    {
    	return 0;
    }
    
    char\* crequest=new char\[request.size()+1\];
    memset(crequest,0,request.size()+1);
    strcpy(crequest,request.c\_str());
    send(client,crequest,(int)strlen(crequest),NULL);
    delete\[\] crequest;
    crequest=0;
    
    char bufrecv\[1000\];
    
    int byRecv=0;
    
    while(byRecv!=SOCKET\_ERROR){
    	memset(bufrecv,0,1000);
    	byRecv=recv(client,bufrecv,999,0);
    	if ( byRecv == 0  ){
    		cout<<"all received out"<<endl;
    
    		return 1;
    
    	}
    	else if(byRecv == WSAECONNRESET){
    		cout<<"wsaeconnreset"<<endl;
    		return 0;
    
    	}
    	answer+=st
    
    C / C++ / MFC help question com announcement

  • "The application has requested the Runtime to terminate it in an unusual way" CRT error??
    J JackPuppy

    here is the official demonstrating: http://support.microsoft.com/kb/884538[^] 1.It is really a problem with CRT, or just another fallacy of my application? 2.if it is really the problem with CRT, and how I can fix it? is the version above 7.1 without this problem? How can I make my application adopt another version?

    C / C++ / MFC help question com announcement
  • Login

  • Don't have an account? Register

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