|
|
 |
 |
 |
 |
register |
bbs |
search |
rss |
faq |
about
|
 |
 |
meet up |
add to del.icio.us |
digg it
|
 |
 |
| Network (in)Security Interesting hacks and cracks. Info on firewalls, TCP/IP, encryption, networks, and security. The ins and outs of the phone system, caller services, how things work, what's illegal and what's not, cellular phones, beepers, telephony legislation, the PUC, ISDN, taps, who's listening, and switches. Talking about phones, hacking systems, technical advice, and such is completely LEGAL in the United States -- it's covered by the First Amendment. What's illegal is conspiracy to commit a crime. So if you say something like "Meet me at 2am so we can crack a can" or "I changed my cell phone's number myself" you are criminally liable. Stating "You can crack a can by doing thus-and-so" or "If you wanted to change a cell phone's number, you could do it like so" is perfectly OK. Posting passwords, calling card numbers, or credit card numbers is forbidden on this network. Posting such info will get you booted off the net. |
 |
|
|
#1
 2002-04-22, 03:08
|
E.S.T: 
Regular
|
|
|
|
a thought
is it posible to change a file size to a specific number ?
|
|
#2
 2002-04-22, 03:48
|
|
Forum Administrator
|
|
Columbus Ohio
|
|
Re: a thought
yes, you need to make a program that will do it for you. it is not a standard function on windows... dunno about any other OS's. but you must also think about what it would fill the file with, extra data that does not mean anything? that might cause it to run slower or to not work at all.
i am sure that there is a program that can inflate files but it would also depend on what kind of file, it would work best on .txt files and not so well on others like .exe or .bat.
|
|
#3
 2002-04-23, 11:49
|
cense 
Regular
|
|
|
|
Re: a thought
.bat files are just text files...
Im not too sure on this question but like it was said, I think the easiest way would just be to pad the file with useless data, the problem with this being that if the file needs to be loaded into memory, it will really bog down the system.
If you are talking about just a way to make the OS *think* the file is a certain size, then I dont really think that is possible, but Im not %100 sure. Try looking at DOS interrupts and see if there is an interrupt to change file size, would be INT21 if there is such a thing, but it probably does not exists... I dont know.
-- cEnsE evil, corruption and bad taste
|
|
#4
 2002-04-30, 08:36
|
soullace 
Regular
|
|
|
|
Re: a thought
Yes its possible, and really not that hard to do. Nothing some C code can't fix. code:
#include <your include files here>
void parse_arguments(int, char*);
int new_size=0; char *file=0x00; //just my style, its a null.
int main(int argc, char **argv) { int size=0; int fd=-1; char *buf=0x00; struct stat f;
//this will initalize new_size, and file. parse_arguments(argc, argv);
stat(file, &f); //pull up the file stat size = f.st_size; //get the current size
if (new_size > size) { //expand file //open the file up fd = open(file, O_APPEND); if (fd = -1) return 1; //allocate a buffer of zeros to append onto the rest of the file. buf = calloc(new_size - size); if (!buf) return 1; //append these zeros to the file. write(fd, buf, new_size - size); //close out the file. close(fd); } else if (new_size < size) { //reduce file //allocate a buffer to read in the file buf = malloc(new_size); if (!buf) return 1; //open the file for read. fd = open(file, O_RDONLY); if (fd == -1) return 1; //read in the file read(fd, buf, new_size); //close it close(fd); //open and truncate the file. fd = open(file, O_TRUNC | O_RDWR); //write out the small version of the file stored in the buffer. write(fd, buf, new_size); //close out the file. close(fd); }
return 0; }
void parse_arguments(int argc, char* argv) { if (argc < 3) exit(1); file = argv[1]; new_size = atoi(argv[2]); }
As you'll notice the code will not compile. It is only meant to give the idea of what is required to do so. [This message has been edited by soullace (edited 04-30-2002).]
|
|
 |
 |
To the best of our knowledge, the text on this page may be freely reproduced and distributed.

totse.com certificate signatures
|
 |
 |
About | Community | Bad Ideas | Drugs | Ego | Erotica | Fringe | Society | Technology
|
 |
 |
 |
 |
|
|