VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Boot/Windows/Makefile
AgeCommit message (Expand)AuthorFilesLines
2022-03-08Implement support of Blake2s-256 hash algorithm and remove deprecated algorit...Mounir IDRASSI1-2/+2
2021-09-04Minor cleanup of the repo (#822)a13460541-1/+1
2017-07-23Windows MBR Bootloader: always compress bootloader with upx to reduce runtime...Mounir IDRASSI1-2/+2
2017-06-23Update IDRIX copyright yearMounir IDRASSI1-1/+1
2016-10-17Windows MBR Bootloader: compress Camellia Rescue Disk bootloader to reduce si...Mounir IDRASSI1-1/+1
2016-06-02Crypto: Add support for Japanese encryption standard Camellia, including for ...Mounir IDRASSI1-0/+3
2016-05-10Remove trailing whitespaceDavid Foerster1-7/+7
2016-05-10Normalize all line terminatorsDavid Foerster1-202/+202
2016-01-20Copyright: update dates to include 2016.Mounir IDRASSI1-1/+1
2015-10-15Windows Rescue Disk: compress bootloader for rescue disk in several more case...Mounir IDRASSI1-2/+2
2015-09-13Windows Bootloader: Fix Rescue Disk issue when Cascades and SHA256 used. It w...Mounir IDRASSI1-0/+4
2015-08-06Update license information to reflect the use of a dual license Apache 2.0 an...Mounir IDRASSI1-5/+8
2014-11-08Add support for SHA-256 in key derivation for bootloader encryption. Create s...Mounir IDRASSI1-0/+11
2014-11-08Add original TrueCrypt 7.1a sourcesMounir IDRASSI1-0/+184
t .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
/*
 Legal Notice: Some portions of the source code contained in this file were
 derived from the source code of TrueCrypt 7.1a, which is 
 Copyright (c) 2003-2012 TrueCrypt Developers Association and which is 
 governed by the TrueCrypt License 3.0, also from the source code of
 Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux
 and which is governed by the 'License Agreement for Encryption for the Masses' 
 Modifications and additions to the original source code (contained in this file) 
 and all other portions of this file are Copyright (c) 2013-2016 IDRIX
 and are governed by the Apache License 2.0 the full text of which is
 contained in the file License.txt included in VeraCrypt binary and source
 code distribution packages. */

#include "Tcdefs.h"

#include <sys/types.h>
#include <sys/stat.h>
#include <direct.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include <Strsafe.h>

#include "Dir.h"

/* create full directory tree. returns 0 for success, -1 if failure */
int
mkfulldir (wchar_t *oriPath, BOOL bCheckonly)
{
	struct _stat st;
	wchar_t *uniq_file;
	wchar_t path [TC_MAX_PATH];

	StringCbCopyW (path, TC_MAX_PATH, oriPath);

	if (wcslen (path) == 3 && path[1] == L':')
		goto is_root;	/* keep final slash in root if present */

	/* strip final forward or backslash if we have one! */
	uniq_file = wcsrchr (path, L'\\');
	if (uniq_file && uniq_file[1] == L'\0')
		uniq_file[0] = L'\0';
	else
	{
		uniq_file = wcsrchr (path, L'/');
		if (uniq_file && uniq_file[1] == L'\0')
			uniq_file[0] = L'\0';
	}

      is_root:
	if (bCheckonly)
		return _wstat (path, &st);

	if (_wstat (path, &st))
		return mkfulldir_internal (path);
	else
		return 0;
}


int
mkfulldir_internal (wchar_t *path)
{
	wchar_t *token;
	struct _stat st;
	static wchar_t tokpath[_MAX_PATH];
	static wchar_t trail[_MAX_PATH];

	StringCbCopyW (tokpath, _MAX_PATH, path);
	trail[0] = L'\0';

	token = wcstok (tokpath, L"\\/");

	if (tokpath[0] == L'\\' && tokpath[1] == L'\\')
	{			/* unc */
		trail[0] = tokpath[0];
		trail[1] = tokpath[1];
		trail[2] = L'\0';
		if (token)
		{
			StringCbCatW (trail, _MAX_PATH, token);
			StringCbCatW (trail, _MAX_PATH, L"\\");
			token = wcstok (NULL, L"\\/");
			if (token)
			{		/* get share name */
				StringCbCatW (trail, _MAX_PATH, token);
				StringCbCatW (trail, _MAX_PATH, L"\\");
			}
			token = wcstok (NULL, L"\\/");
		}
	}

	if (tokpath[1] == L':')
	{			/* drive letter */
		StringCbCatW (trail, _MAX_PATH, tokpath);
		StringCbCatW (trail, _MAX_PATH, L"\\");
		token = wcstok (NULL, L"\\/");
	}

	while (token != NULL)
	{
		int x;
		StringCbCatW (trail, _MAX_PATH, token);
		x = _wmkdir (trail);
		StringCbCatW (trail, _MAX_PATH, L"\\");
		token = wcstok (NULL, L"\\/");
	}

	return _wstat (path, &st);
}