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
M

Madan Chauhan

@Madan Chauhan
About
Posts
61
Topics
26
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • problem while freeing a link list within a vector structure [modified]
    M Madan Chauhan

    thanks for the response. Yes i have declared m_StVector in App class. So i need to clear it. but even i do m_StVector.clear() then still i see those memory leaks that are due to the first node of the link list... well I am still stuck how to free those.

    C / C++ / MFC graphics help

  • problem while freeing a link list within a vector structure [modified]
    M Madan Chauhan

    Hi all.
    I have a link list in a vector structure. It throws exception while freeing first node of the list. This is the sample code-

    //////////Declaration//////
    typedef struct _TEST_STRUCT
    {
    TCHAR _tchTemp[MAX_PATH];
    __int64 i64Temp;
    DWORD dwTemp;
    _TEST_STRUCT *Next;
    }TEST_STRUCT;

    typedef struct _TEST_VECTORST
    {
    int nVal;
    TEST_STRUCT m_ListInVector;

    }TEST_VECTORST;

    std::vector<TEST_VECTORST> m_StVector;
    ////////////////////////////////////////////////////
    /////////Fill Structure//////////////

    CString csVal = L"";
    csVal         = L"hello";
    for (int i = 0; i < 2; i++)
    {
    	memset (&wVectorSt, 0x00, sizeof(TEST\_VECTORST));
    	ptrList = NULL;
    	wVectorSt.nVal = i + 1;
    	int j = 0;
    	while (j<10)
    	{
    		if (ptrList == NULL)
    		{
    			ptrTemp = (TEST\_STRUCT\*)calloc(1,sizeof(TEST\_STRUCT));
    			\_tcscpy(ptrTemp->\_tchTemp, csVal);
    			ptrTemp->dwTemp = 10+j;
    			ptrTemp->i64Temp = 100+j;
    			ptrTemp->Next = NULL;
    			ptrCurrent = ptrList = ptrTemp;
    		}
    		else
    		{
    			ptrTemp = (TEST\_STRUCT\*)calloc(1,sizeof(TEST\_STRUCT));
    			\_tcscpy(ptrTemp->\_tchTemp, csVal);
    			ptrTemp->dwTemp = 10+j;
    			ptrTemp->i64Temp = 100+j;
    			ptrTemp->Next = NULL;
    			ptrCurrent->Next = ptrTemp;
    			ptrCurrent       = ptrTemp;
    
    		}
    		j ++;
    	}
    	memcpy(&wVectorSt.m\_ListInVector, ptrList, sizeof(TEST\_STRUCT));
    	m\_StVector.push\_back (wVectorSt);
    }
    //////Free m\_StVector.m\_ListInVector////
    for (int i = 0; iNext;
    		free(ptrTemp);
    		ptrTemp = NULL;
    	}
    }  
    

    All the nodes become free but one that is very first node in the list does not free.
    if i take start to free from first node like- ptrList = &m_StVector[i].m_ListInVector;

    then it throws exception immidiately and does not free any node...

    Please give me some idea...

    Thanks

    modified on Tuesday, June 21, 2011 4:17 AM

    C / C++ / MFC graphics help

  • How to assign Drive Letter to a volume?
    M Madan Chauhan

    Hi all, There is a volume in my hard drive that currently does not has any drive letter. I need to assign a drive letter to this volume. Please suggest me some way to do so. If a volume has any drive letter already then I can change it's drive letter by getting it's GUID and assign any other drive letter easily. But if the volume does not has any drive letter then how can I get its GUID to assign a drive letter. If there is any other way to do this please suggest me. Thanks & Regards Madan

    C / C++ / MFC question tutorial

  • BYTE to binary conversion
    M Madan Chauhan

    Hi all, if I have BYTE bTemp = 0xAB; I need the binary stream of this BYTE value(ie 010101011) in to an integer Array. Is there any short way to do that rather to write the code to convert it? Thanks M Chauhan

    C / C++ / MFC data-structures question

  • How to convert a CString object to char array in VC++ MFC
    M Madan Chauhan

    hi .. Use _tcscpy() to copy from CString to TCHAR array; ex- CString csMystring = L"Hi all"; TCHAR tchChar[MAX_PATH]; memset(tchChar, 0x00, MAX_PATH); _tcscpy(tchChar, csMystring); Hope it will help. Thanks MChauhan

    C / C++ / MFC c++ data-structures tutorial question

  • initialize disk using c++ code
    M Madan Chauhan

    Well I got it that is IOCTL_disk_create_disk.

    C / C++ / MFC c++ json question

  • initialize disk using c++ code
    M Madan Chauhan

    Hi All, At one place in my code i need to run IOCTL_DISK_DELETE_DRIVE_LAYOUT, that execute smoothly. This IOCTL code make the disk signature as zero so it can not be initialize. I need to initialize this disk using code. Is there any API or any function that can initialize the disk? Please suggest me some way to initialize it using c++ code. Thanks MChauhan

    C / C++ / MFC c++ json question

  • executing .bat file in Vista64 bit
    M Madan Chauhan

    Thanks for replying. Yes all the commands are correct because if I run this batch file with command prompt then it execute successfully. Let me explain- I am running following three commands command1)- bcdedit /set {bootmgr} device boot > D:\m1.txt command2)- bcdedit /set {default} device boot > D:\m3.txt command3)- bcdedit /set {default} osdevice boot > D\m2.txt. These three commands clears Bootmgr of Vista. For runnong these commands I make a batch file and execute it with ShellExecute() For seeing output I used pipe. Then after ShellExecute() if I see these m1,m2,m3 files then these are blank. I am confused now.

    C / C++ / MFC question

  • executing .bat file in Vista64 bit
    M Madan Chauhan

    Hi All, In my application I need to execute some commands. For that I am making a .bat file and execute it using Shellexecute(). It is working well for Vista32 bit, but in Vista64 bit machine Shellexecute() is not running these commands(i am running with Admin privileges also). Does ShellExecute() not support Vista64 bit? Is there any other way for Vista64 bit. Thanks Madan

    C / C++ / MFC question

  • FSCTL_EXTEND_VOLUME fails
    M Madan Chauhan

    Hi, In my application I need to extend the size of a NTFS volume. I use IOCTL_DISK_GROW_PARTITION to grow partition boundary this executes successfully. But after this FSCTL_EXTEND_VOLUME fails with error #87 (incorrect parameter). Please anyone give me some idea that why this control code is failing. Thanks

    C / C++ / MFC help

  • check disk API
    M Madan Chauhan

    Yes. I want to do the same thing with my code (at running stage of machine) that OS do itself at booting time.

    C / C++ / MFC c++ tools json question

  • check disk API
    M Madan Chauhan

    Hi all, I am making an application using vc++, when the process complete I need to boot the machine and at booting time it ask for disk check for FAT32 volume. I dont want that user will see this check disk black screen. So I am trying to check the disk with my code before machine boot. Is there any win32API or any utility that checks disk so that I can implement it in to my code? I dont want to use Chkdsk Method of the Win32_LogicalDisk Class. One more option that I have to execute command chkdsk command on command prompt. But I am looking for any better option. Thanks Regards M Chauhan

    C / C++ / MFC c++ tools json question

  • Get drive letter of Hard drive
    M Madan Chauhan

    Thanks for your kind support. I will apply it today. Thanks Madan

    C / C++ / MFC question

  • Get drive letter of Hard drive
    M Madan Chauhan

    Hi all, My application is for windows Vista and XP. There are more than on Hard drive connected to my machine. I need to get Drive Letters of the Hard drive from which my system is booting. By using GetLogicalDriveStrings Function I can get the drive letters of all Hard drives. But how can I differentiate that this particular drive letter is the partition name of my booting Hard drive? The structure of disks are: disk0(Booting with this)- C D G disk1- E F H disk2- I J I need to get the C,D,G only. Thanks Madan

    C / C++ / MFC question

  • How to Create and format partitions
    M Madan Chauhan

    OH... Pardon me I have quoted you without reading this reply from ur side. I am just checking for these FMIFS.h and FMIFS.dll Thanks

    C / C++ / MFC tools tutorial question career

  • How to Create and format partitions
    M Madan Chauhan

    Thanks CMyLife. I am not sure that you will get my query today coz this thread is of one day old. I have successfully created the partition using IOCTL_DISK_SET_DRIVE_LAYOUT. But now I am stuck in formatting this raw partition. There is one function FormatEx() but it is only for Vista. Is there any other way to format partition without using DISKPART and SHFormatDrive like some ioctl code. Thanks

    C / C++ / MFC tools tutorial question career

  • How to Create and format partitions
    M Madan Chauhan

    Thanks CMylife. I am going to implement it now. I will consult you after trying it. thanks

    C / C++ / MFC tools tutorial question career

  • How to Create and format partitions
    M Madan Chauhan

    Hi all, I am creating an application for windows Vista, XP and 2003Server. In my application I need to create and format partitions(Extended and primary both). I do not want to use DISKPART utility. Is there any other way to do this job like by using any win32API or any function provided by Microsoft in MSDN? Please give me some suggestions. Thanks

    C / C++ / MFC tools tutorial question career

  • Extend vloume using FSCTL_EXTEND_VOLUME
    M Madan Chauhan

    Thanks for ur support CmyLife I done it.

    C / C++ / MFC help

  • Extend vloume using FSCTL_EXTEND_VOLUME
    M Madan Chauhan

    Thanks for your guidance. I dont have any idea which API or function extend the boundary of partition. Please tell me if you know that one. thanks.

    C / C++ / MFC help
  • Login

  • Don't have an account? Register

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