Jump to content

Welcome to MSFN Forum
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account


Photo

Add Makecab and Expand in SendTo

- - - - -

  • Please log in to reply
70 replies to this topic

#1
jdoe

jdoe

    Advanced Member

  • Member
  • PipPipPip
  • 314 posts
-----
EDIT january 9, 2006
-----

CAB Tool 1.8
Cabinet files compression/decompression program, including
Cabinet files creation from folders/subfolders.

v1.8
Better display of error messages.

New way for identifying Cabinet file. Instead of looking at the file
name, Cabinet files are recognize by SetupIterateCabinet API function.

XP Visual Style have been added on form (was not applied as supposed).

Cancel button added.

Improved installer.

-----

The batches and VBScripts are always available but I wrote a program to replace them called CAB Tool.

The program use the SendTo folder like the previous scripts but do not use EXPAND.EXE, MAKECAB.EXE or CABARC.EXE. All API.

Run on Windows 2000 and higher.


CAB Tool details


PECheckSum
Another SendTo folder program to edit checksum of PE files. Do the same as the -c switch of MODIFYPE.
This new version have one advantage over MODIFYPE: file modification date is not updated.

Edited by jdoe, 19 January 2006 - 03:27 PM.



How to remove advertisement from MSFN

#2
MCT

MCT

    MSFN Junkie

  • Member
  • PipPipPipPipPipPipPipPipPip
  • 3,291 posts
  • OS:none specified
  • Country: Country Flag
cool :D what is %~dps1 just curious :P
Posted Image Posted Image
Windows 7 32Bit 2GB Ram 120GB HDD (Laptop), Windows 8 4GB Ram 1TB HDD (Desktop) Windows XP SP3 VM with enhancements!

#3
jdoe

jdoe

    Advanced Member

  • Member
  • PipPipPip
  • 314 posts
@MCT
When you select a file and click on Makecab in SendTo folder (for example), %1 is passed to this batch (%1 is the full file path).

%~dps1 extract the short path name of the folder where the file is

%1 = d:\folder path\file.txt

then

%~dps1 = d:\folder~1\

;)

#4
MCT

MCT

    MSFN Junkie

  • Member
  • PipPipPipPipPipPipPipPipPip
  • 3,291 posts
  • OS:none specified
  • Country: Country Flag
oh, cool :D , i knew what %1 was, just not the other, thanks :D
Posted Image Posted Image
Windows 7 32Bit 2GB Ram 120GB HDD (Laptop), Windows 8 4GB Ram 1TB HDD (Desktop) Windows XP SP3 VM with enhancements!

#5
gunsmokingman

gunsmokingman

    MSFN Master

  • Super Moderator
  • 2,418 posts
  • OS:none specified
  • Country: Country Flag
Thank you I will make use of it


GunSmokingMan



#6
idle.newbie

idle.newbie

    Junior

  • Member
  • Pip
  • 93 posts
another script to makeCab a whole directory, output to parent folder, named folderName.cab, in cmdWindow or Explorer(install cmd in line1&2).

cmdWindow:
cabIt path\to\anyFolder
or without argument to cab current directory and output to parent directory.
cabIt

Attached Files

  • Attached File  cabIt.js   1.78KB   482 downloads


#7
jdoe

jdoe

    Advanced Member

  • Member
  • PipPipPip
  • 314 posts
@idle.newbie - nice script
You put your link to cabIt in context menu in this reg HKCR\Directory
Personnally I put Command Prompt Here in HKCR\Folder
Someone know the difference between these two reg. It looks like they do the same things.

I'm working on something like cabIt for the SendTo folder because I have so much things in Context Menu that's why I'm using SendTo to free some space.
----------------------


I made a modification to MAKECAB.CMD to prevent strange behaviors when selecting a folder by mistake or when the file size = 0
If you have previously downloaded these batch - re-download to make sure you have the good one.

#8
idle.newbie

idle.newbie

    Junior

  • Member
  • Pip
  • 93 posts
i don't know the exactly difference, basically HKCR\Folder = HKCR\Directory + HKCR\Drive + and more(like some special shell folder), HKCR\Directory more physical directory, i like HKCR\Folder but not this case(my script may not work correct on specialFolder, and i don't want it to apply on DriveRoot).
SendTo's nice, but my script needs only a directory, SendTo works on File too, too lazy to check for file or directory.

#9
sleepnmojo

sleepnmojo

    Advanced Member

  • Member
  • PipPipPip
  • 472 posts
Nice batches. You might want to not have it prompt the user for the modifype. Could just have it check for certain files, since not all are executable. Plus the programs need to be in the path, which not everyone knows how to do.

Something I did learn which I didn't know before is how you use modifype. I could never get it to work with the full path. Never tried making it short like you did. I always just did a pushd, then popd back. Still can't get the > NUL to work on it though.

One more thing shouldn't
IF %FSIZE%==0 GOTO END
be
IF %FSIZE% EQU 0 GOTO END


#10
SiMoNsAyS

SiMoNsAyS

    C'mon you apes! You wanna live forever!?

  • Patrons
  • 3,455 posts
maybe you can help me with this jdoe, it looks stupid but...
@ECHO OFF
dir %1 /-p /o:gn > %SYSTEMDRIVE%\Dir.txt
PAUSE
... this will store the contents of the folder on a %SYSTEMDRIVE%\Dir.txt file, how can i store it in the same folder that i want to print the contents?

#11
jdoe

jdoe

    Advanced Member

  • Member
  • PipPipPip
  • 314 posts
@sleepnmojo
Good idea, I will remove prompt and only check for file extension but what are the file that need a CRC header edits - I know EXE, DLL but what are the others (if any) ?
You're right that it's more logical to make numbers comparison with IF %NUMERIC% EQU X but it work with a strings comparison too.
The installer put these batch in system32 so they are in the path.


@SiMoNsAyS
This batch create DIR.TXT with a folder contents (%1) and prevent DIR.TXT to appear in it. Otherwise DIR.TXT would contain DIR.TXT in the listing because you put it in the same directory of the DIR %1 command.

@ECHO OFF
IF EXIST "%~f1\DIR.TXT" DEL /F /Q "%~f1\DIR.TXT"
DIR %1 /O:GN>"%TEMP%\DIR.TXT"
MOVE "%TEMP%\DIR.TXT" "%~f1\DIR.TXT"

;)

#12
SiMoNsAyS

SiMoNsAyS

    C'mon you apes! You wanna live forever!?

  • Patrons
  • 3,455 posts
@jdoe thanks dude :thumbup
just a bit of my taste but i preffer to add the /A /-P switches to the dir command :P

#13
webservices

webservices

    Junior

  • Member
  • Pip
  • 54 posts
hi,

I installed your batch but i have a problem using it.
the expand command works perfectly, but when i wanna makecab my dll, the dll disappear like if it was deleted. Even any file i try to makecab vanishes.

Nobody knows what's happening ?


weeb,

#14
SiMoNsAyS

SiMoNsAyS

    C'mon you apes! You wanna live forever!?

  • Patrons
  • 3,455 posts
@webservices, dll it's deleted by default. if you don't want to, remove this line from makecab.cmd
DEL /F /Q %1


#15
sleepnmojo

sleepnmojo

    Advanced Member

  • Member
  • PipPipPip
  • 472 posts

hi,

I installed your batch but i have a problem using it.
the expand command works perfectly, but when i wanna makecab my dll, the dll disappear like if it was deleted. Even any file i try to makecab vanishes.

Nobody knows what's happening ?


weeb,

My guess is either you don't have makecab and modifype in your path, or something goes wrong in them. You can modify makecab.cmd and take out the del statement, and add a pause at the end to see whats happening.

@jdoe - you might want to do a errorlevel check before going on to the next step. modifype -> makecab -> del

#16
webservices

webservices

    Junior

  • Member
  • Pip
  • 54 posts
I guess maybe it is cause i put ModifyPE.exe in system32 as i downloaded the file, but i see that in the vbs the file called is modifytype

FOR %%I IN (.EXE .DLL .SYS .OCX .CPL .COM) DO IF /I "%%I"=="%EXT%" MODIFYPE.EXE %~fs1 -c

I guess if i rename it to MODIFYPE.EXE it shoudl works. I will give it a try ....

Weeb,

Nope i tryed, still doesn't work. ummmm, maybe a path problem, but expand should not work as well, or it does.

#17
jdoe

jdoe

    Advanced Member

  • Member
  • PipPipPip
  • 314 posts
@webservices
I made modification to batches. Now you will have a message if an error occurred. It's gonna be easier for me to know whats the problem.
Dont' forget that the original file is deleted, if you send a file to Makecab the file is deleted and a new compressed one is created.
If you want to keep the original file like SyMoNsAyS said, delete line DEL /F /Q %1


@sleepnmojo
ModifyPE don't return an error code but if you look at the batch, I found a workaround.

#18
webservices

webservices

    Junior

  • Member
  • Pip
  • 54 posts
@jdoe

Thx for your fast updates, respect .... Thanks to your logs, i do suspect a corrupt profile. I have a fresh install in a VMware, i am gonna test it in here and give you a feedback.

here are the logs i got : The good part is that my files are not deleted anymore :)
Concerning teh expand focntion, i have no probleme.

1) makecab WINNT32U.DLL


Microsoft ® Cabinet Maker - Version 5.1.2600.0
Copyright © Microsoft Corporation. All rights reserved..

EnsureDirectory: Cant create file: C:\DOCUME~1\chirs\BUREAU\COMPBA~1\ADDMAK~1\NOUVEA~1\WINNT32U.DLL\CAB03540.TMP, errno=
2, _doserrno=3, GLE=3
ERROR: Path is invalid: C:\DOCUME~1\chirs\BUREAU\COMPBA~1\ADDMAK~1\NOUVEA~1\WINNT32U.DLL
Appuyez sur une touche pour continuer...


2) makecab winspool.exe


ERROR - MODIFYPE CAN'T PATCH winspool.exe
Appuyez sur une touche pour continuer...

EDIT : Ok i did a new try in a clean installation of XP, and i got the same error.
It's like a path problem, so maybe the fact my OS is french with accentuated letters, that put a mess in it.

I am waiting for your investigations ....

#19
jdoe

jdoe

    Advanced Member

  • Member
  • PipPipPip
  • 314 posts
@webservices

Man you're not lucky, in fact there is 1 bug I can solve and 1 I can't.

1) WINSPOOL.EXE is not a Win32 executable file so it don't need a CRC header edits and by the way what kind of hacking are you doing on this file. You should not need to play with this file or there is something I don't know about this file. If you give me a good reason, I will try to do something for that.

2) For WINNT32U.DLL (and all Win32 executable file) the problem is a behavior of MAKECAB.EXE and it's not a path problem. It seem to be a french Windows problem (j'ai la même erreur que toi mais j'ignore si c'est le SP1 ou Windows francais). I have few ideas for solving this problem. I'm working on it...

#20
webservices

webservices

    Junior

  • Member
  • Pip
  • 54 posts
;) i am sure you gonna make it .... I can still use a cmd btach to launch some makecab command when i need it. but your vbs is quiet cool and easy to use.

For the WINSPOOL.EXE, my fault, i just took an .exe without looking at if it was win32 executable or not. Sorry to have confused you. Who would like to hack that file ?

A french ? oh god, we are mad but not at this point yest :)

Catch you later on.

Weeb. :hello:

#21
jdoe

jdoe

    Advanced Member

  • Member
  • PipPipPip
  • 314 posts
@webservices

Both problems are solved. The script will know what kind of file it is and will not display an error when there is none. I know there is no utility to decompress winspool.exe but anyway now you can decompress and recompress any file.

I made test with english and french Windows and it worked well. Let me know if you still have errors but I think this time it will be ok.


;)

#22
webservices

webservices

    Junior

  • Member
  • Pip
  • 54 posts
@jdoe.

sorry not to have responded to you earlier, but i have been away for a few days.

First of all, thx ever so much cause now it is working perfectly on my french OS, and be sure I am using your scipts for my custom XP cd.

Best wishes on your next developments .....

Weeb,

#23
RyanVM

RyanVM

    Like a big surly teddy bear.

  • Member
  • PipPipPipPipPipPipPipPip
  • 2,661 posts
Is there a way to have the cmd file automatically make the file name uppercase when running makecab?
RyanVM MSFN Files | RyanVM Forums
Please do not link directly to files on my site or modify/redistribute them without getting my permission first. Link to the above URL instead.
Current Update Pack Release: 2.2.2
(Released April 28, 2008)

BTW, 90% of what I say is kidding around. Don't take things so personally ;)

#24
jdoe

jdoe

    Advanced Member

  • Member
  • PipPipPip
  • 314 posts
@webservices
Great :hello:


@RyanVM
I have tried to do so but there is a bug with the french character "é" - "É" :angry:
and I need these batch to work with both french and english Windows.
It's surely possible with an external .EXE program (a kind of renamer.exe) but I want a simple batch for that.
With no bugs with french characters I would do something like this to convert file name to uppercase...

SET UCN=%1
SET UCN=%UCN:a=A%
SET UCN=%UCN:b=B%
SET UCN=%UCN:c=C%
SET UCN=%UCN:d=D%
SET UCN=%UCN:e=E%
SET UCN=%UCN:f=F%
SET UCN=%UCN:g=G%
SET UCN=%UCN:h=H%
SET UCN=%UCN:i=I%
SET UCN=%UCN:j=J%
SET UCN=%UCN:k=K%
SET UCN=%UCN:l=L%
SET UCN=%UCN:m=M%
SET UCN=%UCN:n=N%
SET UCN=%UCN:o=O%
SET UCN=%UCN:p=P%
SET UCN=%UCN:q=Q%
SET UCN=%UCN:r=R%
SET UCN=%UCN:s=S%
SET UCN=%UCN:t=T%
SET UCN=%UCN:u=U%
SET UCN=%UCN:v=V%
SET UCN=%UCN:w=W%
SET UCN=%UCN:x=X%
SET UCN=%UCN:y=Y%
SET UCN=%UCN:z=Z%

SET UCN=%UCN:é=É%
SET UCN=%UCN:à=À%
...
..
.


BTW this is working for the english Windows - if you want a makecab.cmd with this code in it let me know and I will post a makecab.cmd for english Windows only - for uppercase file name (compressed)

#25
RyanVM

RyanVM

    Like a big surly teddy bear.

  • Member
  • PipPipPipPipPipPipPipPip
  • 2,661 posts
I'm in the US, so an English-only version doesn't bother me :P
RyanVM MSFN Files | RyanVM Forums
Please do not link directly to files on my site or modify/redistribute them without getting my permission first. Link to the above URL instead.
Current Update Pack Release: 2.2.2
(Released April 28, 2008)

BTW, 90% of what I say is kidding around. Don't take things so personally ;)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users



How to remove advertisement from MSFN