CompressString()???

Moderator: Rathinagiri

Post Reply
Red2
Posts: 273
Joined: Sat May 18, 2019 2:11 pm
DBs Used: Visual FoxPro, FoxPro
Location: United States of America

CompressString()???

Post by Red2 »

Hi,

In the HMG Doc.CHM I found the following 2 functions. But, when I try to use it I get "syntax error"

I want to directly read some compressed data from a file into my program. I do not want to, first, uncompress this data to disk.

Question: Does HMG currently support these 2 functions? If so, any ideas on what I am doing wrong?

Any help would be greatly appreciated!

Thank you very much,
Red2

COMPRESSSTRING() Compress an string
Syntax: CompressString(@<cString>,@<nSize>)
Arguments: <cString> Buffer to compress, must be passed by reference.
<nSize> The Lenght of the compression String

UNCOMPRESSSTRING() Uncompress an String
Syntax: UNCOMPRESSSTRING(<cBuffer>,<nSize>) ---> <cUncompressBuffer>
Arguments: <cBuffer> The compressing string to uncompress
<nSize> The saved size returned by compressionstring
Returns: <cUncompressBuffer> The String uncompressed
Red2
Posts: 273
Joined: Sat May 18, 2019 2:11 pm
DBs Used: Visual FoxPro, FoxPro
Location: United States of America

Re: CompressString()???

Post by Red2 »

Correction, the actual error is:

hbmk2: Error: Referenced, missing, but unknown function(s): COMPRESSSTRING()
User avatar
mustafa
Posts: 1160
Joined: Fri Mar 20, 2009 11:38 am
DBs Used: DBF
Location: Alicante - Spain
Contact:

Re: CompressString()???

Post by mustafa »

Hola Red2
Desconozco las Funciones que mencionas
pero si solo quieres ver el contenido
del Fichero Zip aqui te mando un sample
que esta extraído del Sample que publiqué

viewtopic.php?f=8&t=5864&p=57940&hilit=zip#p57940

HB_ZIP_Demo.zip

PD: Para poder compilar es necesario no omitir
hbziparc.hbc , incluido en Demo_Zip.hbp
Sample
hbziparc.hbc

Saludos
Mustafa
*---------------------- Google --------------------*
Hi Red2
I don't know the Functions you mention
but if you just want to see the content
of the Zip File here I send you a sample
which is extracted from the Sample that I published

viewtopic.php?f=8&t=5864&p=57940&hilit=zip#p57940

HB_ZIP_Demo.zip

PD: In order to compile it is necessary not to skip
hbziparc.hbc, included in Demo_Zip.hbp
Sample
hbziparc.hbc

Regards
Mustafa
Attachments
View_Zip.zip
(1.53 KiB) Downloaded 173 times
User avatar
AUGE_OHR
Posts: 2064
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: CompressString()???

Post by AUGE_OHR »

Red2 wrote: Fri Dec 27, 2019 2:07 pm In the HMG Doc.CHM I found the following 2 functions. But, when I try to use it I get "syntax error"
that is in
Documentation for (x)Harbour
Dedicated to MiniGui users.
in harbour Changlog i found

Code: Select all

contrib/hbzlib/strcomp.c
but i don't have that File :?:

Question : why do you want to compress a String :?:
do you have Problem with 2 GB Limit ...
have fun
Jimmy
Red2
Posts: 273
Joined: Sat May 18, 2019 2:11 pm
DBs Used: Visual FoxPro, FoxPro
Location: United States of America

Re: CompressString()???

Post by Red2 »

Hi Jimmy,

Thank you so much for your kind reply. Perhaps I can be much clearer.

My real goal: I want to create a text file whose contents is more or less obfuscated that I can, later, directly read into my HMG program. (Hence my interest in some compression and uncompression).

Question: Can HMG somehow directly read the contents of a ZIP file into a program (without first unzipping to a disk file)?

In Visual Foxpro I had a great piece of (.FLL) code that allowed me to directly and easily read a ZIP file's contents right into my VFP program as a string without UNzipping it first to another file. I have not yet found how to do this in HMG!

In short, I need to read of an obfuscated disk file's contents into a program's string (and, if necessary, un-obfuscate it inside my program).

I hope that this is clearer. Thanks again for all of your gracious help!
------------------------------
Muchas gracias por su amable respuesta. Quizás pueda ser mucho más claro.

Mi objetivo real: quiero crear un archivo de texto cuyo contenido esté más o menos ofuscado y que luego pueda leer directamente en mi programa HMG. (De ahí mi interés en algo de compresión y descompresión).

Pregunta: ¿Puede HMG leer de alguna manera directamente el contenido de un archivo ZIP en un programa (sin descomprimir primero en un archivo de disco)?

En Visual Foxpro tenía una gran pieza de código (.FLL) que me permitía leer directa y fácilmente el contenido de un archivo ZIP directamente en mi programa VFP como una cadena sin descomprimirlo primero en otro archivo. ¡Todavía no he encontrado cómo hacer esto en HMG!

En resumen, necesito leer el contenido de un archivo de disco ofuscado en la cadena de un programa (y, si es necesario, desenfusarlo dentro de mi programa).

Espero que esto sea más claro. Gracias de nuevo por toda su amable ayuda!

Red2
User avatar
AUGE_OHR
Posts: 2064
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: CompressString()???

Post by AUGE_OHR »

hi,

i have not the Source of hbZIP so i don't know how it work.

since XP we have ZIP "build-in" Windows and that use ZIP as Folder.
so you "just" have to open ZIP as Folder and than can do what you want.

this Code is to UnZIP to a Folder

Code: Select all

FUNCTION Unzip(cZipFile, cDestFolder)
LOCAL oShell, oZIP, oNameDest
   oShell    := CreateObject("Shell.Application")
   oZIP  := oShell:NameSpace(cZipFile)
   oNameDest := oShell:NameSpace(cDestFolder)
   oNameDest:CopyHere(oZIP:items(), 0x10)
   oShell:destroy()
RETURN NIL
have fun
Jimmy
Post Reply