Using Vice without Steam: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (paszelchitro)
m (→‎What is this?: remove terminology that nobody uses)
 
(6 intermediate revisions by 5 users not shown)
Line 1: Line 1:
[http://rickmay.com/wp-content/uploads/2007/c4thenfok.htm paintings for sale] [http://dbs-83.net/photos.bkp/plugins/urls/news-1323.html nature boys] [http://macquaker.org/blog/wp-content/uploads/2006/page-190.html tournament players club at the canyons] [http://linksinventory.com/temp/templates/cache/text-1838.html decorative switchplates] [http://multimedia247.com/billing/app-modernbill-order/files/resource-1950.html dometic] [http://forgoodnesssake-green.com/commerce/images/news/topic-1240.html glutathione] [http://marukadod.com/main/nse/csv/text1708.htm kraltv] [http://beach-candids.com/sitedepth/_assets/css/css/elsatrre-2161.html war pictures] [http://sk8springfield.com/guestbook/templates/scripts/news-101-20080422.html star trek the next generation] [http://multimedia247.com/billing/app-modernbill-order/files/sitemap.html main] [http://beach-candids.com/sitedepth/_assets/css/css/index.html web] [http://paramedicweb.info/ftp_uploads/screenshots/image/text-267.html admission application form] [http://rickmay.com/wp-content/uploads/2007/varfokx.htm joshua tree lodging] [http://inko9nito.com/portfolio/upgrade/locale/su/erwficari844.htm split croatia] [http://ecotribeonline.com/forms/use/intext/news-1668.html reduction of amides] [http://inko9nito.com/portfolio/upgrade/locale/su/qasvard1610.htm liquid coffee concentrate] [http://hippoworks.com//12all/admin/attach/files/sitemap.html main] [http://leskratch.com/form/use/Miss/comment582.htm lsa glassware uk] [http://www.appliedseo.com/wp-content/backup-fbdb4/sql/envarrel.html sand dollar] [http://multimedia247.com/billing/app-modernbill-order/files/resource-2094.html acura forum] [http://chetty.mu/blog/content/07/02/boctro-1513.html ryan renolds] [http://ecotribeonline.com/forms/use/intext/news-198.html compass cove] [http://freepublictransit.org/wwdems/ml/attachments/images/page1396.html canadian immigration services] [http://i-sniper.com/store/images/46/page-1308.html julius caesar history] [http://beach-candids.com/sitedepth/_assets/css/css/sitxvartr-1708.html belmont tech] [http://inko9nito.com/portfolio/upgrade/locale/su/faplzpa784.htm trash compactors] [http://multimedia247.com/billing/app-modernbill-order/files/resource-1613.html pba] [http://fineartfilm.com/images/watermark/icons/2422.html commercial fountain designers] [http://fineartfilm.com/images/watermark/icons/1629.html securities professionals] [http://chong.org.uk/amyyee/data/media/img/article660.html helmet laws] [http://inko9nito.com/portfolio/upgrade/locale/su/ersedne2079.htm silver bullet] [http://emilieheymans.ca/news/data/backup/sql/comment-2640.htm mayor race new york city] [http://chetty.mu/blog/content/07/02/nesittrp-1074.html security of state michigan] [http://gilbertpaquette.org/news/data/upimages/img/qualitroc.html we come one] [http://emilieheymans.ca/news/data/backup/sql/comment-670.htm msc] [http://linksinventory.com/temp/templates/cache/text-78.html kbots] [http://gilbertpaquette.org/news/data/upimages/img/dronxbug.html association lawyer texas trial] [http://dbs-83.net/photos.bkp/plugins/urls/news-1581.html power rangers in space episodes] [http://dbs-83.net/photos.bkp/plugins/urls/news-2143.html systemic insecticide imidacloprid] [http://barrowhabitat.org/public_ftp/incoming/notes/page-1862.html japanese girl games] [http://gravityservices.co.uk/demo/images/thumbs/index.html homepage] [http://inko9nito.com/portfolio/upgrade/locale/su/basbrin1437.htm biggest breasts world record] [http://gilbertpaquette.org/news/data/upimages/img/licaboce.html lonely housewives stories] [http://linksinventory.com/temp/templates/cache/text-1919.html public school township washington] [http://www.appliedseo.com/wp-content/backup-fbdb4/sql/sitemap.html home] [http://lonepixel.com/wp-content/uploads/2007/moncdeld-400.html dna paternity testing services] [http://chong.org.uk/amyyee/data/media/img/article675.html toyota fj cruiser photo] [http://linksinventory.com/temp/templates/cache/text-1016.html shannen doherty gallery] [http://multimedia247.com/billing/app-modernbill-order/files/resource-1238.html vapor barrier insulation] [http://marinduque.gov.ph/smf/attachments/images/article1062.htm yardbirds home and garden] [http://cross-stitch4you.ca/startpages/test/scripts/article-1985.htm interior design fabrics] [http://ecotribeonline.com/forms/use/intext/news-2015.html unique baby boys names] [http://cross-stitch4you.ca/startpages/test/scripts/article-2310.htm lactaid pills] [http://multimedia247.com/billing/app-modernbill-order/files/resource-1692.html dataw island real estate] [http://ecotribeonline.com/forms/use/intext/news-295.html ticket printing machines] [http://neriwonda.com/files/pictures/pics/index.html www] [http://dbs-83.net/photos.bkp/plugins/urls/news-271.html nudnicks] [http://emilieheymans.ca/news/data/backup/sql/comment-1437.htm sony television repair part] [http://lonepixel.com/wp-content/uploads/2007/quatrlo-156.html accel cap distributor] [http://lonepixel.com/wp-content/uploads/2007/quabasn-1657.html meads restaurant] [http://i-sniper.com/store/images/46/page-383.html optics] [http://freepublictransit.org/wwdems/ml/attachments/images/page466.html the sick rose interpretation] [http://www.appliedseo.com/wp-content/backup-fbdb4/sql/recawre.html martin d 18 guitar] [http://barrowhabitat.org/public_ftp/incoming/notes/page-1329.html lake tahoe real estate] [http://barrowhabitat.org/public_ftp/incoming/notes/sitemap.html map] [http://beach-candids.com/sitedepth/_assets/css/css/darc4tvie-1872.html toilet sign] [http://chetty.mu/blog/content/07/02/laouc4t-433.html nike infant clothing] [http://cross-stitch4you.ca/startpages/test/scripts/article-2135.htm usps passport form] [http://rickmay.com/wp-content/uploads/2007/index.htm more] [http://chong.org.uk/amyyee/data/media/img/article592.html lone star preview marching] [http://inko9nito.com/portfolio/upgrade/locale/su/ricboc1025.htm speed fins surf] [http://rickmay.com/wp-content/uploads/2007/enfevzel.htm rpg online games 3d] [http://rickmay.com/wp-content/uploads/2007/etacbugd.htm runco] [http://leskratch.com/form/use/Miss/comment167.htm big butts in tight jeans] [http://marinduque.gov.ph/smf/attachments/images/article2630.htm belleville illinois animal shelter] [http://chong.org.uk/amyyee/data/media/img/article576.html 5 cable cat crimp kit] [http://inko9nito.com/portfolio/upgrade/locale/su/faerfudom2271.htm these are the days] [http://chetty.mu/blog/content/07/02/zarpasqu-1230.html mescalero apaches] [http://neriwonda.com/files/pictures/pics/comment-1510.html style quizzes] [http://cross-stitch4you.ca/startpages/test/scripts/article-1558.htm teknik lingkungan itb] [http://emilieheymans.ca/news/data/backup/sql/comment-324.htm industrial computers] [http://ecotribeonline.com/forms/use/intext/news-1153.html volvo c30] [http://cross-stitch4you.ca/startpages/test/scripts/article-1582.htm takaful national] [http://linksinventory.com/temp/templates/cache/text-2028.html ep graphic] [http://marukadod.com/main/nse/csv/text2431.htm sheila house] [http://linksinventory.com/temp/templates/cache/text-713.html corbin seats] [http://hippoworks.com//12all/admin/attach/files/topic307.htm work gloves] [http://cross-stitch4you.ca/startpages/test/scripts/article-869.htm prince kiss mp3 download] [http://lonepixel.com/wp-content/uploads/2007/lanec4tmo-645.html legal pittsburgh service] [http://leskratch.com/form/use/Miss/comment935.htm clarissa] [http://marinduque.gov.ph/smf/attachments/images/article2280.htm newsrover] [http://uniqueconceptsspa.com/specials/Files/29.htm general motors canada] [http://multimedia247.com/billing/app-modernbill-order/files/sitemap.html domain] [http://fineartfilm.com/images/watermark/icons/945.html tnt express worldwide track] [http://beach-candids.com/sitedepth/_assets/css/css/cobocd-2051.html scottish jewelry] [http://chetty.mu/blog/content/07/02/lamexpas-668.html zi zis] [http://ecotribeonline.com/forms/use/intext/news-915.html lawyer lawrenceville ga] [http://beach-candids.com/sitedepth/_assets/css/css/olochise-723.html keisha evans] [http://neriwonda.com/files/pictures/pics/index.html www] [http://i-sniper.com/store/images/46/page-846.html italo disco] [http://dbs-83.net/photos.bkp/plugins/urls/news-2160.html windows safe mode xp] [http://dbs-83.net/photos.bkp/plugins/urls/news-1454.html saddlebred] [http://marinduque.gov.ph/smf/attachments/images/article2538.htm aqa] [http://ecotribeonline.com/forms/use/intext/news-32.html couples sexual positions] [http://cross-stitch4you.ca/startpages/test/scripts/article-1543.htm flight schedules] [http://cross-stitch4you.ca/startpages/test/scripts/article-301.htm inthe vip] [http://macquaker.org/blog/wp-content/uploads/2006/page-34.html new york newspapers] [http://media514.com/editionsblocnotes/cache/temp/new815.htm plus size bra] [http://hippoworks.com//12all/admin/attach/files/topic1847.htm nightloop] [http://media514.com/editionsblocnotes/cache/temp/new57.htm stoneware bowl] [http://neriwonda.com/files/pictures/pics/comment-1970.html abbs dive site st] [http://linksinventory.com/temp/templates/cache/sitemap.html domain] [http://gravityservices.co.uk/demo/images/thumbs/page-1370.html french currency] [http://marinduque.gov.ph/smf/attachments/images/article1727.htm poconos] [http://linksinventory.com/temp/templates/cache/text-651.html trussville auto mart] [http://chong.org.uk/amyyee/data/media/img/article892.html pontiac vibe] [http://gravityservices.co.uk/demo/images/thumbs/page-1055.html a map of pa] [http://ecotribeonline.com/forms/use/intext/news-107.html new york tooth implant] [http://multimedia247.com/billing/app-modernbill-order/files/resource-641.html winxp media center serial] [http://inko9nito.com/portfolio/upgrade/locale/su/acdarbas1415.htm team america song] [http://chong.org.uk/amyyee/data/media/img/article647.html americas test kitchen] [http://ecotribeonline.com/forms/use/intext/sitemap.html home] [http://media514.com/editionsblocnotes/cache/temp/new338.htm oops celebs nicole kidman] [http://multimedia247.com/billing/app-modernbill-order/files/resource-65.html ladders marine steel] [http://macquaker.org/blog/wp-content/uploads/2006/page-2156.html neopets crossword puzzle] [http://ecotribeonline.com/forms/use/intext/news-110.html christmas songs] [http://beach-candids.com/sitedepth/_assets/css/css/ellodeze-279.html herb ritts] [http://neriwonda.com/files/pictures/pics/comment-1213.html equine classifieds virginia] [http://dbs-83.net/photos.bkp/plugins/urls/news-701.html wizardry 7 walkthrough] [http://linksinventory.com/temp/templates/cache/text-913.html sex with my first cousin] [http://cross-stitch4you.ca/startpages/test/scripts/article-1631.htm minnesota viking address] [http://paramedicweb.info/ftp_uploads/screenshots/image/text-1819.html lake chatuge georgia] [http://lonepixel.com/wp-content/uploads/2007/nofuneac-1729.html postales gratis para imprimir] [http://barrowhabitat.org/public_ftp/incoming/notes/page-913.html mansion for sale] [http://sk8springfield.com/guestbook/templates/scripts/news-1380-20080425.html serikat] [http://paramedicweb.info/ftp_uploads/screenshots/image/text-26.html dot to dot] [http://chetty.mu/blog/content/07/02/lafokhe-1808.html mineral make-up] [http://multimedia247.com/billing/app-modernbill-order/files/resource-1474.html omar bradley] [http://inko9nito.com/portfolio/upgrade/locale/su/nesedf922.htm teenage wrestling] [http://paramedicweb.info/ftp_uploads/screenshots/image/text-134.html sample female ejaculation video] [http://media514.com/editionsblocnotes/cache/temp/new778.htm bain de soleil] [http://beach-candids.com/sitedepth/_assets/css/css/mexfevboc-2578.html caller ringtone] [http://beach-candids.com/sitedepth/_assets/css/css/fokdel-2626.html medical restraint] [http://gravityservices.co.uk/demo/images/thumbs/page-319.html denver home] [http://inko9nito.com/portfolio/upgrade/locale/su/bugwva804.htm glass flower vases] [http://barrowhabitat.org/public_ftp/incoming/notes/index.html top] [http://linksinventory.com/temp/templates/cache/text-1831.html rmvb] [http://gilbertpaquette.org/news/data/upimages/img/darcacn.html tech lighting] [http://chetty.mu/blog/content/07/02/c4ttad-591.html helga] [http://gravityservices.co.uk/demo/images/thumbs/page-1216.html lawyers directory] [http://rickmay.com/wp-content/uploads/2007/domderic.htm bed side table] [http://dbs-83.net/photos.bkp/plugins/urls/news-40.html where can i buy ielts books] [http://beach-candids.com/sitedepth/_assets/css/css/nonekod-88.html free mac games] [http://gravityservices.co.uk/demo/images/thumbs/page-139.html download games] [http://barrowhabitat.org/public_ftp/incoming/notes/page-158.html lawrence] [http://www.appliedseo.com/wp-content/backup-fbdb4/sql/ergetnoac.html travel chanel] [http://marinduque.gov.ph/smf/attachments/images/article1664.htm saddleback covenant church] [http://barrowhabitat.org/public_ftp/incoming/notes/page-1125.html jayachandra] [http://freepublictransit.org/wwdems/ml/attachments/images/page774.html state income tax] [http://marinduque.gov.ph/smf/attachments/images/article2234.htm hair growth system] [http://emilieheymans.ca/news/data/backup/sql/comment-1302.htm the spokesman review.com] [http://multimedia247.com/billing/app-modernbill-order/files/resource-2173.html application illinois secretary state title] [http://gilbertpaquette.org/news/data/upimages/img/darace.html filmmaking equipment] [http://cross-stitch4you.ca/startpages/test/scripts/article-2204.htm lingerie clothing online store] [http://forgoodnesssake-green.com/commerce/images/news/topic-298.html giga galleries] [http://multimedia247.com/billing/app-modernbill-order/files/resource-1724.html rejection line.com] [http://lonepixel.com/wp-content/uploads/2007/daracg-171.html whats the difference] [http://ecotribeonline.com/forms/use/intext/news-1364.html chiropractor relief doctor] [http://www.appliedseo.com/wp-content/backup-fbdb4/sql/c4tercare.html xho1 site] [http://multimedia247.com/billing/app-modernbill-order/files/resource-786.html pre approved credit cards] [http://linksinventory.com/temp/templates/cache/text-1550.html wildland jacket] [http://multimedia247.com/billing/app-modernbill-order/files/resource-893.html vertical horizon] [http://beach-candids.com/sitedepth/_assets/css/css/fiqast-1992.html andria] [http://neriwonda.com/files/pictures/pics/comment-848.html university of saskatchewan] [http://inko9nito.com/portfolio/upgrade/locale/su/qasloric1628.htm houston mls] [http://marinduque.gov.ph/smf/attachments/images/article1751.htm el paso nursing home] [http://macquaker.org/blog/wp-content/uploads/2006/page-2289.html strength as a teacher] [http://macquaker.org/blog/wp-content/uploads/2006/page-1252.html tyranny guild burning legion] [http://chong.org.uk/amyyee/data/media/img/article1602.html ayline] [http://marinduque.gov.ph/smf/attachments/images/article1686.htm contentment] [http://rickmay.com/wp-content/uploads/2007/henricr.htm party game ideas] [http://i-sniper.com/store/images/46/page-71.html 5a aircraft british se] [http://linksinventory.com/temp/templates/cache/text-919.html prince william charles] [http://sk8springfield.com/guestbook/templates/scripts/news-398-20080430.html submissive sluts] [http://marukadod.com/main/nse/csv/text321.htm estate manayunk real] [http://uniqueconceptsspa.com/specials/Files/35.htm beach wallpaper] [http://inko9nito.com/portfolio/upgrade/locale/su/index.htm web] [http://marinduque.gov.ph/smf/attachments/images/article2313.htm moonligt] [http://multimedia247.com/billing/app-modernbill-order/files/resource-1436.html sidekick phone covers] [http://gilbertpaquette.org/news/data/upimages/img/outrocs.html redstone federal credit union] [http://hippoworks.com//12all/admin/attach/files/topic1060.htm jet airways] [http://beach-candids.com/sitedepth/_assets/css/css/cnazbolot-1564.html girls caught on camera] [http://inko9nito.com/portfolio/upgrade/locale/su/trbocel1513.htm raining all over the world] [http://cross-stitch4you.ca/startpages/test/scripts/article-431.htm self employment medical insurance 3] [http://sk8springfield.com/guestbook/templates/scripts/news-683-20080427.html wonder lake il zip code] [http://barrowhabitat.org/public_ftp/incoming/notes/page-922.html multi grain pancake mix] [http://rickmay.com/wp-content/uploads/2007/rofuhen.htm prince of persia 2 xbox guide] [http://ecotribeonline.com/forms/use/intext/news-503.html hordes of the underdark walkthrough] [http://beach-candids.com/sitedepth/_assets/css/css/index.html link] [http://www.appliedseo.com/wp-content/backup-fbdb4/sql/tamonroc4.html abraxas]
== What is this? ==
== What is this? ==
This is a [[Steam port]] of [[Vice|VICE]] that is built to not depend on Steam. This modification works on Windows and Linux.
This is a modified version of [[Vice|VICE]] that is built to not depend on Steam. This modification works on Windows and Linux.


== Pre-Built binaries ==
== Pre-Built binaries ==
http://3dwire.net/bin/ice.zip
* http://3dwire.net/bin/ice.zip '''(Link is dead)'''
* https://github.com/foobarhl/vice_standalone/raw/master/bin/vice '''Built on Ubuntu 12.04.2 LTS'''


== Compiling on Windows ==
== Compiling on Windows ==
Line 19: Line 19:
== main.cpp ==
== main.cpp ==
<pre>
<pre>
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
//
//
// Purpose: Standalone utility to encrypt files with ice encryption, that doesn't
// Purpose: Standalone utility to encrypt files with ice encryption, that doesn't
Line 56: Line 56:
void Usage( void )
void Usage( void )
{
{
fprintf( stdout, "Usage: ice <-d> <-x ext> [-k IceKey(8 byte)] [file]\n" );
printf( "Usage: ice <-d> <-x ext> [-k IceKey(8 byte)] [file]\n" );
fprintf( stdout, "Default action: Encrypt. \n" );
printf( "Default action: Encrypt. \n" );
fprintf( stdout, "-d : Decrypt a file. \n" );
printf( "-d : Decrypt a file. \n" );
fprintf( stdout, "-x : Extension to use as output. \n" );
printf( "-x : Extension to use as output. \n" );
fprintf( stdout, "-k : You need to specify your 8 byte Ice Encryption Key. \n" );
printf( "-k : You need to specify your 8 byte Ice Encryption Key. \n" );
fprintf( stdout, "-h : Print the help menu, and stop.\n" );
printf( "-h : Print the help menu, and stop.\n" );
}
}



Latest revision as of 15:28, 9 August 2023

What is this?

This is a modified version of VICE that is built to not depend on Steam. This modification works on Windows and Linux.

Pre-Built binaries

Compiling on Windows

  • First you need to create a new Empty VisualC++ Console Project that will compile this code into an executable.
  • Add public/IceKey.cpp into your project
  • Setup the include paths in your settings to include public/ (for the header file)
  • Copy the code below into main.cpp, and compile.

Compiling on Linux

  • Copy the makefile into a file called Makefile
  • edit the Makefile to reflect the path to your SDK_ROOT/public/ directory
  • make

main.cpp

//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose: Standalone utility to encrypt files with ice encryption, that doesn't
//			 depend on Steam.
//
// Author: Valve Software and Scott Loyd (scottloyd@gmail.com).
//			Tested and proofread by Me2.
// Depends on: Just needs public/IceKey.cpp to be compiled/linked with it
// $NoKeywords: $
//
//=============================================================================//

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "IceKey.H"

// Globals
static bool g_Encrypt = true; //By default we encrypt

#define MAX_ICE_KEY 8
#define MAX_EXTENSION 16
static char g_ICEKey[MAX_ICE_KEY];
static char g_Extension[MAX_EXTENSION];

#ifdef WIN32
#define STRING_CMP stricmp
#else
#define STRING_CMP strcasecmp
#undef NULL
#define NULL 0
#endif


//----- Helpers -----
void Usage( void )
{
	printf( "Usage: ice <-d> <-x ext> [-k IceKey(8 byte)] [file]\n" );
	printf( "Default action: Encrypt. \n" );
	printf( "-d : Decrypt a file. \n" );
	printf( "-x : Extension to use as output. \n" );
	printf( "-k : You need to specify your 8 byte Ice Encryption Key. \n" );
	printf( "-h : Print the help menu, and stop.\n" );
}

void Exit(const char *msg)
{
	fprintf( stderr, msg );
	exit( 1 );
}

void SetExtension(char *dest, size_t length, const char *ext)
{
	//Start at the end till we hit a .
	//if we reach 0 without a .  just append the extension; one must not have existed.
	size_t mover = length;

	while( (*(dest + mover) != '.') && (mover > 0))
		mover--;

	if(mover == 0)
		strcat(dest,ext);
	else
	{
		strcpy(dest + mover,ext);
	}
}

/*
The entry point, see usage for I/O
*/
int main(int argc, char* argv[])
{
	if(argc < 2)
	{
		Usage();
		exit( 0 );
	}
	
	//By default we output .ctx
	strncpy( g_Extension, ".ctx",MAX_EXTENSION );
	memset(g_ICEKey,0,MAX_ICE_KEY);

	int i = 1;
	while( i < argc )
	{
		if( STRING_CMP( argv[i], "-h" ) == 0 )
		{
			Usage();
			exit( 0 );
		} 
		else if( STRING_CMP( argv[i], "-d" ) == 0 )
		{
			g_Encrypt = false;
		} 
		else if( STRING_CMP( argv[i], "-x" ) == 0 )
		{
			//Extension
			i++;

			if ( strlen( argv[i] ) > MAX_EXTENSION )
			{
				Exit("Your Extension is too big.\n");
			}

			strncpy( g_Extension, argv[i], MAX_EXTENSION );
		}
		else if( STRING_CMP( argv[i], "-k" ) == 0 )
		{
			//Key
			i++;

			if ( strlen( argv[i] ) != MAX_ICE_KEY )
			{
				Exit("Your ICE key needs to be 8 characters long.\n");
			}

			strncpy( g_ICEKey, argv[i], MAX_ICE_KEY );
		}
		else 
		{
			break;
		}
		i++;
	}

	if(g_ICEKey[0] == '\0') {
		Exit("You need to specify a key.\n");
	}
	//Parse files starting from current arg position
	if(argv[i] == NULL && (strlen(argv[i]) < 1))
		Exit("Was not about to find a file to parse\n");

	//Open allocate/read a file into memory
	FILE *pFile;
	pFile = fopen (argv[i], "rb");
	if(! pFile)
		Exit("Failed to open input file\n");

	long lFileSize; //Size of input file
	unsigned char *pBuff; //Holds the input file contents
	unsigned char *pOutBuff; //Holds the output goodies

	// obtain file size.
	fseek (pFile , 0 , SEEK_END);
	lFileSize= ftell (pFile);
	rewind (pFile);

	// allocate memory to contain the whole file.
	pBuff = (unsigned char*) malloc (lFileSize);
	pOutBuff = (unsigned char*) malloc (lFileSize);

	if (pBuff == NULL || pOutBuff == NULL)
	{
		fclose(pFile);
		Exit("Could not allocate buffer\n");;
	}

	// copy the file into the buffer.
	fread (pBuff,1,lFileSize,pFile);
	
	//clean the output buffer
	memset(pOutBuff,NULL,lFileSize);

	fclose(pFile);

	//Lets start the ice goodies!
	IceKey ice( 0 ); // level 0 = 64bit key
	ice.set( (unsigned char*) g_ICEKey ); // set key

	int blockSize = ice.blockSize();

	unsigned char *p1 = pBuff;
	unsigned char *p2 = pOutBuff;

	// encrypt data in 8 byte blocks
	int bytesLeft = lFileSize;

	while ( bytesLeft >= blockSize )
	{
		if ( g_Encrypt )
			ice.encrypt( p1, p2 );
		else
			ice.decrypt( p1, p2 );

		bytesLeft -= blockSize;
		p1+=blockSize;
		p2+=blockSize;
	}

	//The end chunk doesn't get an encryption?  that sux...
	memcpy( p2, p1, bytesLeft );

	size_t outLength = strlen(argv[i]) + MAX_EXTENSION + 1;
	char *pOutPath = (char *)malloc(outLength);
	strncpy(pOutPath,argv[i],outLength);

	SetExtension(pOutPath, outLength, g_Extension);

	pFile = fopen (pOutPath , "wb");
	if(pFile == NULL)
	{
		fprintf( stderr, "Was not able to open output file for writing.\n" );
		goto dealloc;
	}

	fwrite (pOutBuff , 1 , lFileSize , pFile);
	fclose (pFile);

dealloc:
	free(pBuff);
	free(pOutBuff);
	free(pOutPath);
}

Linux Makefile

#Simple Makefile for compiling on Linux
CPP = g++
PUBLIC=../../public

ice:
	${CPP} -o $@ main.cpp ${PUBLIC}/IceKey.cpp -I${PUBLIC}

clean:
	-rm -f ice

(Optional) Perl Script to make life easier

I use Env. Variables in all my scripts because of multiple developers, so you can either hardcode the variables, or set the env. variables on your system (see msdn docs. for that). Also, to take this even further, on my system I created a new MSVC project, then changed it to a utility project (leaving me with just build events); I then called the perl script as my post-build and MSVC now does everything for me in my build process.

#!/usr/bin/perl
# easy script that compiles our scripts folder and then moves them to our mod directory!

use warnings;
use strict;

use File::Copy;


our $outExt = ".ctx";

our $baseOutput = $ENV{'MOD_CONTENT'};
die("Could not find MOD_CONTENT envirornment variable.\n") if !$baseOutput;
our $outputDir = $baseOutput."\\scripts";

our $inputDir = $ENV{'CODE_SCRIPTS'};
die("Could not find CODE_SCRIPTS envirornment variable.\n") if !$inputDir;

our $iceKey = $ENV{'ICE_KEY'};
die("Could not find ICE_KEY envirornment variable.\n") if !$iceKey;


our $devToolPath = $ENV{'CODE_DEVTOOLS'};
die("Could not find CODE_DEVTOOLS envirornment variable.\n") if !$devToolPath;

printf(" ** Encrypting scripts and copying them into your mod ** \n");

my $command = "$devToolPath\\ice -x $outExt -k $iceKey ";

opendir DH, $inputDir or die "Could not open code-scripts directory\n";

	while ($_ = readdir(DH))
	{
		# we don't want to process . or .. directory holders.
		next if $_ eq ".";
		next if $_ eq "..";
		next if -d $_;
		next if $_ !~ m/.txt$/;
		
		my $inFile = $inputDir."\\".$_;
		system($command.$inFile);
		
		#printf "Command: ".$command.$inFile."\n";
		
		#Get a filename/path without the extension, add the extension to the end.
		my $outFile = $outputDir."\\".$_;
		$outFile =~ s/(.*).txt$/$1.ctx/;
		$inFile =~ s/(.*).txt$/$1.ctx/;
		
		#printf "InFile: ".$inFile."\n";
		#printf "OutFile: ".$outFile."\n";
		move($inFile,$outFile);
	}
closedir DH;

See also