Re: Compiled ocx file reports different sizes



Hi,

Here are the command lines being used to compile the ocx file,

@echo off

if "%OS%"=="Windows_NT" @setlocal

set COMPONENT_BASE_NAME=%1
if "%COMPONENT_BASE_NAME%"=="" set COMPONENT_BASE_NAME=myactivex.ocx

set DEPLOY_DIR=%2
if "%DEPLOY_DIR%"=="" set DEPLOY_DIR=D:\MyProjects

set PROJECT_DEPLOY_DIR=%3
if "%DEPLOY_DIR%"==""
set PROJECT_DEPLOY_DIR=\activex\

if "%VC_HOME%" == "" goto noVCHome


Rem Set Resource Compiler path
Rem
if not exist "%VC_HOME%\..\Common7\Tools\Bin\rc.exe" goto rcAuxPath
set RSCL="%VC_HOME%\..\Common7\Tools\Bin\rc.exe"
goto checkMIDL
:rcAuxPath
if not exist "%VC_HOME%..\vb98\wizards\rc.exe" goto noVCHome
set RSCL="%VC_HOME%..\vb98\wizards\rc.exe"

:checkMIDL
Rem Set MIDL.EXE path
Rem
if not exist "%VC_HOME%\bin\midl.exe" goto MidlAuxPath
set MIDL="%VC_HOME%\Bin\midl.exe"
goto next
:MidlAuxPath
if not exist "%VC_HOME%\..\Common7\Tools\Bin\midl.exe" goto noVCHome
set MIDL="%VC_HOME%\..\Common7\Tools\Bin\midl.exe"
goto next

:noVCHome
echo VC_HOME is set incorrectly. Please set VC_HOME.
goto end

:next

set VCL="%VC_HOME%\Bin\cl.exe"
set VLINK="%VC_HOME%\Bin\link.exe"
set VLIB="%VC_HOME%\Bin\lib.exe"

echo Using VC_HOME "%VC_HOME%"
echo Using Midl.exe "%MIDL%"
echo Using Rc.exe "%RSCL%"
echo Using vc Compiler "%VCL%"
echo Using vc Linker "%VLINK%"
echo Using vc Lib "%VLIB%"

rem Root of Visual Developer Studio Common files.
set VSCommonDir=C:\PROGRA~1\MICROS~3\Common

rem Root of Visual Developer Studio installed files.
rem
set MSDevDir=C:\PROGRA~1\MICROS~3\Common\msdev98

rem Root of Visual C++ installed files.
rem
set MSVCDir=d:\MICROS~1\VC98

rem VcOsDir is used to help create either a Windows 95 or Windows NT
specific path.
set VcOsDir=WIN95
if "%OS%" == "Windows_NT" set VcOsDir=WINNT

echo Setting environment for using Microsoft Visual C++ tools.
if "%OS%" == "Windows_NT" set
PATH=%MSDevDir%\BIN;%MSVCDir%\BIN;%VSCommonDir%\TOOLS\%VcOsDir%;%VSCommonDir%\TOOLS;%PATH%

if "%OS%" == "" set
PATH="%MSDevDir%\BIN";"%MSVCDir%\BIN";"%VSCommonDir%\TOOLS\%VcOsDir%";"%VSCommonDir%\TOOLS";"%windir%\SYSTEM";"%PATH%"

set
INCLUDE=%MSVCDir%\ATL\INCLUDE;%MSVCDir%\INCLUDE;%MSVCDir%\MFC\INCLUDE;%INCLUDE%
set LIB=%MSVCDir%\LIB;%MSVCDir%\MFC\LIB;%LIB%
set VcOsDir=
set VSCommonDir=

rem Include path
set PT_INC=../../pthread/include
set C_INC=../../../c/native/include
set CPP_INC=../../../cpp/native/include

rem Set library paths
set C_LIB=%DEPLOY_DIR%\c\lib
set CPP_LIB=%DEPLOY_DIR%\cpp\lib
set PTHREAD_LIB=%DEPLOY_DIR%\pthread\lib

rem Library Files
set CRTL_LIB=%C_LIB%\crtl.lib
set CPPRTL_LIB=%CPP_LIB%\cpprtl.lib
set WS32_LIB=wsock32.lib
set PTHREAD_LIB=%PTHREAD_LIB%\pthreadvc.lib
set RTL_LIBS=%CRTL_LIB% %CPPRTL_LIB% %WS32_LIB% %PTHREAD_LIB%


rem Source path
set SRC=..\src

rem Files to compile

rem Output path
set OUT="%PROJECT_DEPLOY_DIR%/lib"

echo Environment Variables
echo ---------------------
echo OS : %OS%
echo Component Base Name : %COMPONENT_BASE_NAME%

echo Step 1: Making tlb files
set FTC=%SRC%\myactivex.odl
%MIDL% /nologo /D "NDEBUG" /mktyplib203 /win32 /tlb "myactivex.tlb"
%FTC%

echo Step 2: Compiling Resource file
set FTC=%SRC%\myactivex.rc
%RSCL% /l 0x409 /fo"myactivex.res" /i "../include" /d "NDEBUG" /d
"_AFXDLL" %FTC%

echo Step 3: Compiling source
set FTC=%SRC%\myactivexPpg.cpp %SRC%\myactivexCtl.cpp
%SRC%\myactivex.cpp

%VCL% /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D
"_WINDLL" /D "_AFXDLL" /D "_MBCS" /D "_USRDLL" /Fo"" /Fd"" /FD /c /I
%C_INC% /I %CPP_INC% /I "../include" %FTC%

echo echo Step 4: Compiling source
set FTC=%SRC%\StdAfx.cpp
%VCL% /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D
"_WINDLL" /D "_AFXDLL" /D "_MBCS" /D "_USRDLL" /Fp"myactivex.pch"
/Yc"stdafx.h" /I "../include" /Fo"" /Fd"" /FD /c %FTC%

echo Step 5: Linking...
set FTL="StdAfx.obj" "myactivex.obj" "myactivex.res" "myactivexCtl.obj"
"myactivexPpg.obj"
%VLINK% %RTL_LIBS% /OUT:%COMPONENT_BASE_NAME% /libpath:%C_LIB%
/libpath:%CPP_LIB% /nologo /subsystem:windows /dll /incremental:no
/pdb:"myactivex.pdb" /machine:I386 /def:"%SRC%\myactivex.def"
/implib:"myactivex.lib" %FTL%

echo Step 5: Registering Active X component
regsvr32 /s /c %COMPONENT_BASE_NAME%
echo regsvr32 exec. time > "regsvr32.trg"
echo Server component registred successfully


echo Step 6: Deleting temporary files

copy *.ocx %OUT%
rem copy *.exp %OUT%
rem copy *.trg %OUT%
rem copy *.lib %OUT%


del *.ocx
del *.exp
del *.trg
del *.lib
del *.obj
del *.res
del *.tlb
del *.pch
del *.idb

:end

if "%OS%"=="Windows_NT" @endlocal


----

Kindly help.
I am using a set of command lines for compiling and linking the
project,
am I doing wrong.

Suggest
sandspiderX

.



Relevant Pages

  • Re: Command line FTP help
    ... rem Version 1.0 ... if ==GOTO NOPARAM1 ... echo An error occured whilst encrypting the file>> %log% ... > rem This part of the program encrypts the input file and produces an ...
    (microsoft.public.win2000.networking)
  • Re: dos batch programmer help!!
    ... REM Set up your two serial numbers here and ensure dir C:\TEMP\ exists ... if errorlevel 1 goto otherdisk ... echo Wrong diskin H: -- swap it to allow backup to continue! ...
    (comp.os.msdos.programmer)
  • Re: dos batch programmer help!!
    ... REM Set up your two serial numbers here and ensure dir C:\TEMP\ exists ... if errorlevel 1 goto otherdisk ... echo Wrong diskin H: -- swap it to allow backup to continue! ...
    (comp.os.msdos.programmer)
  • [EXPL] MS-SQL Vulnerability Exploiting Trusted Connections
    ... rem Scan networks for SQL servers that allow access via db guest account ... Echo Ping Testing %2 ... If Not %Guest_Vulnerable%==Yes Goto Checks_Done ...
    (Securiteam)
  • Some batch files for applying MS03-026
    ... find all the Win2k systems. ... the patch to the remote system. ... REM * Author: ... Echo Querying the supplied list for Win2k systems. ...
    (microsoft.public.win2000.security)