Click here to Skip to main content
Click here to Skip to main content
 
Add your own
alternative version
Go to top

Multidevice ASIO output plugin for WinAMP

, 13 Feb 2009
A tiny WinAMP output DLL that uses a C++ replacement of the official ASIO SDK that supports multiple ASIO devices.
#pragma once

#include "windows.h"

#include "errno.h"


#define DECL_PROLOG inline errno_t __fastcall

DECL_PROLOG strcpy_s
(
    char *strDestination,
    size_t numberOfElements,
    const char *strSource 
)
{
    if ( numberOfElements == 0 )
        return ERANGE;
    if ( !strDestination || !strSource )
        return EINVAL;
    ::strcpy( strDestination, strSource );
    return 0;
}


DECL_PROLOG wcscat_s
(
    wchar_t * strDestination,
    size_t numberOfElements,
    const wchar_t *strSource 
)
{
    if ( numberOfElements == 0 )
        return ERANGE;
    if ( !strDestination || !strSource )
        return EINVAL;
    ::wcscat( strDestination, strSource );
    return 0;
}

DECL_PROLOG strcat_s
(
    char * strDestination,
    size_t numberOfElements,
    const char *strSource 
)
{
    if ( numberOfElements == 0 )
        return ERANGE;
    if ( !strDestination || !strSource )
        return EINVAL;
    ::strcat( strDestination, strSource );
    return 0;
}

DECL_PROLOG wcscpy_s
(
    wchar_t * strDestination,
    size_t numberOfElements,
    const wchar_t *strSource 
)
{
    if ( numberOfElements == 0 )
        return ERANGE;
    if ( !strDestination || !strSource )
        return EINVAL;
    ::wcscpy( strDestination, strSource );
    return 0;
}

DECL_PROLOG strncpy_s
(
    char * strDestination,
    size_t numberOfElements,
    const char *strSource,
    size_t count
)
{
    if ( numberOfElements < count )
        return ERANGE;
    if ( !strDestination || !strSource )
        return EINVAL;
    ::strncpy( strDestination, strSource, count );
    return 0;
}

DECL_PROLOG wcsncpy_s
(
    wchar_t * strDestination,
    size_t numberOfElements,
    const wchar_t * strSource,
    size_t count
)
{
    if ( numberOfElements < count )
        return ERANGE;
    if ( !strDestination || !strSource )
        return EINVAL;
    ::wcsncpy( strDestination, strSource, count );
    return 0;
}

inline int __fastcall vsprintf_s
(
    char *buffer,
    size_t numberOfElements,
    const char *format,
    va_list argptr
)
{
    if ( numberOfElements > 1024 )
        return -1;
    return ::wvsprintfA( buffer, format, argptr );
}

inline int __fastcall vswprintf_s
(
    wchar_t *buffer,
    size_t numberOfElements,
    const wchar_t *format,
    va_list argptr
)
{
    if ( numberOfElements > 1024 )
        return -1;
    return ::wvsprintfW( buffer, format, argptr );
}


#define wstrcpy_s(dest, destsize, source) ::wstrcpy((dest), (source))
#define wstrncpy_s(dest, destsize, source) ::wstrncpy((dest), (source))

#define swprintf_s _snwprintf
#define sprintf_s _snprintf
//#define _vsnprintf_s _vsnprintf

#undef DECL_PROLOG

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Common Development and Distribution License (CDDL)

Share

About the Author

Domagoj Šarić
Software Developer Little Endian Ltd.
Croatia Croatia
No Biography provided

| Advertise | Privacy | Mobile
Web04 | 2.8.140916.1 | Last Updated 13 Feb 2009
Article Copyright 2009 by Domagoj Šarić
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid