[Action Plugin] Clipboard 2.0.3.0

Plugins y todo lo relacionado para Autoplay Media Studio.
Buenas amigos de AMSSpecialist.com hoy os traigo la enésima modificación del Action Plguin Clipboard, aun que la he titulado 2.0.3.0 es mas bien una 2.0.2.1 por que no he modificado el codigo mucho simplemente he reeditado el proyecto desde Cero usando el ejemplo que lleva el SDK 2.0.0.1 y añadiendo la nueva función y algunos datos que cuando trasteamos pabloko no cambio, esta versión es una versión no Oficial de modo que si queréis soporte tenéis que pedirlo aquí y no al foro de IR.

Código
Código Modificado en ClipboardFunctions.cpp:
#include "stdafx.h"
#include "ClipboardFunctions.h"
#include "IRPluginHelperFunctions.h"

static int irclipboard_copytext (lua_State *L)
{
int nLastError = 0;
IRLUA_PLUGIN_ResetLastError(L);

IRLUA_PLUGIN_CheckNumArgs(L,1);

CString strText;
strText = IRLUA_PLUGIN_CheckString(L,1);

if(OpenClipboard(NULL))
{
/*HGLOBAL clipbuffer;
char * buffer;
EmptyClipboard();
clipbuffer = GlobalAlloc(GMEM_DDESHARE, strText.GetLength()+1);
buffer = (char*)GlobalLock(clipbuffer);
#if _MSC_VER < 1400
strcpy(buffer, LPCSTR(strText));
#else
strcpy_s(buffer, sizeof(buffer), LPCSTR(strText));
#endif
GlobalUnlock(clipbuffer);
SetClipboardData(CF_TEXT,clipbuffer);
CloseClipboard();
*/
HGLOBAL clipbuffer;
char * buffer;
EmptyClipboard();
const int nBuffLength = strText.GetLength()+1;
clipbuffer = GlobalAlloc(GMEM_DDESHARE, nBuffLength);
buffer = (char*)GlobalLock(clipbuffer);
#if _MSC_VER < 1400
strcpy(buffer, LPCSTR(strText));
#else
strcpy_s(buffer, nBuffLength, LPCSTR(strText));
#endif
GlobalUnlock(clipbuffer);
SetClipboardData(CF_TEXT,clipbuffer);
CloseClipboard();

} else
{
nLastError = 12010;
}

IRLUA_PLUGIN_SetLastError(L,nLastError);
return 0;
}

static int irclipboard_gettext (lua_State *L)
{
int nLastError = 0;
IRLUA_PLUGIN_ResetLastError(L);

char * buffer = NULL;
//open the clipboard
CString fromClipboard;

if(!IsClipboardFormatAvailable(CF_TEXT))
{
fromClipboard = "";
} else
{
if ( OpenClipboard(NULL) )
{
HANDLE hData = GetClipboardData( CF_TEXT );
char * buffer = (char*)GlobalLock( hData );
fromClipboard = buffer;
GlobalUnlock( hData );
CloseClipboard();
} else
{
fromClipboard = "";
nLastError = 12010;
}
}

IRLUA_PLUGIN_SetLastError(L,nLastError);
lua_pushstring(L,fromClipboard.GetBuffer(0));
fromClipboard.ReleaseBuffer();

return 1;
}

static int irclipboard_istextavailable (lua_State *L)
{
int nLastError = 0;
IRLUA_PLUGIN_ResetLastError(L);
BOOL bReturn = FALSE;

if(IsClipboardFormatAvailable(CF_TEXT))
{
bReturn = TRUE;
}

IRLUA_PLUGIN_SetLastError(L,nLastError);
lua_pushboolean(L,bReturn);
return 1;
}

static int irclipboard_copyfile (lua_State *L)
{
int nLastError = 0;
IRLUA_PLUGIN_ResetLastError(L);

IRLUA_PLUGIN_CheckNumArgs(L,1);

CString path;
BOOL bCopy;

path = IRLUA_PLUGIN_CheckString(L,1); //obtenemos el string
bCopy = IRLUA_PLUGIN_CheckBoolean(L,2); //obtenemos el booleano de copia o corte


//path.Replace("|", ""

//--------------------------------------------CString path, BOOL nCopy
char tmp[256]; //TODO@: 256 caracteres no es muy poco?
ZeroMemory(tmp,256);
for(int i = 0;i<path.GetLength();i++) //Inyectamos uno a uno cada caracter de nuestro string en una cadena de memoria char, guardada en memoria volatil
{
if (path.GetAt(i)!=0x7c) tmp = path.GetAt(i); //como con lua no hay forma de insertar un simbolo 0x00 obtenemos un caracter digamos raro | (0x7c) si lo encuentra en esta posicion de memoria no escribimos nada, lo cual dejara la cadena como 0x00
}
//--------------------------------------------char *lpBuffer, UINT uBufLen, BOOL bCopy

//todo esto inicia variables que vamos a usar
char *lpBuffer;
UINT uBufLen;

UINT uDropEffect;
DROPFILES dropFiles;
UINT uGblLen,uDropFilesLen;
HGLOBAL hGblFiles,hGblEffect;
char *szData,*szFileList;

DWORD *dwDropEffect;



//CutOrCopyFiles(tmp,path.GetLength(),nCopy);


lpBuffer=tmp;
uBufLen=path.GetLength();
//bCopy = true;

//configuramos el drop effect, osea, copia o corte
uDropEffect=RegisterClipboardFormat("Preferred DropEffect");
hGblEffect=GlobalAlloc(GMEM_ZEROINIT|GMEM_MOVEABLE|GMEM_DDESHARE,sizeof(DWORD));
dwDropEffect=(DWORD*)GlobalLock(hGblEffect);
if(bCopy)
*dwDropEffect=DROPEFFECT_COPY;
else
*dwDropEffect=DROPEFFECT_MOVE;
GlobalUnlock(hGblEffect);

uDropFilesLen=sizeof(DROPFILES);
dropFiles.pFiles =uDropFilesLen;
dropFiles.pt.x=0;
dropFiles.pt.y=0;
dropFiles.fNC =FALSE;
dropFiles.fWide =TRUE;

//escribimos la memoria con mierda aleatoria que funciona gracias a los hijos de puta de ms

uGblLen=uDropFilesLen+uBufLen*2+8;
hGblFiles= GlobalAlloc(GMEM_ZEROINIT|GMEM_MOVEABLE|GMEM_DDESHARE, uGblLen);
szData=(char*)GlobalLock(hGblFiles);
memcpy(szData,(LPVOID)(&dropFiles),uDropFilesLen);
szFileList=szData+uDropFilesLen;

//hora de convertir nuestra mierda de bytes a una cadena wide, despues de 2 conversiones ya... otra maravilla gracias a los colegas de ms

MultiByteToWideChar(CP_ACP,MB_COMPOSITE,
lpBuffer,uBufLen,(WCHAR *)szFileList,uBufLen);

GlobalUnlock(hGblFiles);


//esto no necesita explicacion¿?
if( OpenClipboard(NULL) )
{
EmptyClipboard(); //jodemos todo lo que haya
SetClipboardData( CF_HDROP, hGblFiles ); //usamos CF_HDROP que nos va a permitir copiar y pegar mierdas
SetClipboardData(uDropEffect,hGblEffect); //agregamos el drop effect
CloseClipboard(); //mandamos a tomar por culo la memoria usada
}
return 0;
}

const luaL_reg tab_funcs[] = {
{"CopyText", irclipboard_copytext},
{"GetText", irclipboard_gettext},
{"IsTextAvailable", irclipboard_istextavailable},
{"CopyFile", irclipboard_copyfile},
{NULL, NULL}
};


int lua_cblibopen (lua_State *L) {


luaL_openlib(L, "Clipboard", tab_funcs, 0);

IRLUA_PLUGIN_SetGlobalErrorMessage(L,12010,"Failed to open clipboard.");

return 0;
}


Código Modificado en IRClipboard.cpp:
// IRClipboard.cpp : Defines the initialization routines for the DLL.
//

#include "stdafx.h"
#include "IRClipboard.h"
#include "ClipboardFunctions.h"
#include "IRPluginHelperFunctions.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

//
// Note!
//
// If this DLL is dynamically linked against the MFC
// DLLs, any functions exported from this DLL which
// call into MFC must have the AFX_MANAGE_STATE macro
// added at the very beginning of the function.
//
// For example:
//
// extern "C" BOOL PASCAL EXPORT ExportedFunction()
// {
// AFX_MANAGE_STATE(AfxGetStaticModuleState());
// // normal function body here
// }
//
// It is very important that this macro appear in each
// function, prior to any calls into MFC. This means that
// it must appear as the first statement within the
// function, even before any object variable declarations
// as their constructors may generate calls into the MFC
// DLL.
//
// Please see MFC Technical Notes 33 and 58 for additional
// details.
//

/////////////////////////////////////////////////////////////////////////////
// CIRClipboardApp

BEGIN_MESSAGE_MAP(CIRClipboardApp, CWinApp)
//{{AFX_MSG_MAP(CIRClipboardApp)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CIRClipboardApp construction

CIRClipboardApp::CIRClipboardApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}

/////////////////////////////////////////////////////////////////////////////
// The one and only CIRClipboardApp object

CIRClipboardApp theApp;

#define SIZE_XML_STRING 10000

char szObjectName[] = "Clipboard";
char szXML[SIZE_XML_STRING];

char szInformation[] = "Clipboard Actions Plugin\r\nCreated by Indigo Rose Corporation\r\nPabloko & Ceone modified for AMSSpecialist.com\r\n"
"http://www.amsspecialist.com";

int irPlg_GetPluginName(char* szBuffer, int* pnBufferSize)
{
// The proper name of the object as it will appear on the Plugins menu
int nLength = lstrlen(szObjectName);
if(*pnBufferSize < nLength)
{
*pnBufferSize = nLength;
return -1;
} else
{
memset(szBuffer,0,*pnBufferSize);
lstrcpy(szBuffer,szObjectName);
return nLength;
}
}

int irPlg_GetPluginVersion(char* szBuffer, int* pnBufferSize)
{
// Always returns this, do not remove or modify...
int nLength = lstrlen("2.0.3.0");
if(*pnBufferSize < nLength)
{
*pnBufferSize = nLength;
return -1;
} else
{
memset(szBuffer,0,*pnBufferSize);
lstrcpy(szBuffer,"2.0.3.0");
return nLength;
}
}

int irPlg_GetAuthorInfo(char* szBuffer, int* pnBufferSize)
{
// Always returns this, do not remove or modify...
int nLength = lstrlen(szInformation);
if(*pnBufferSize < nLength)
{
*pnBufferSize = nLength;
return -1;
} else
{
memset(szBuffer,0,*pnBufferSize);
lstrcpy(szBuffer,szInformation);
return nLength;
}
}

int irPlg_GetPluginActionXML(char* szBuffer, int* pnBufferSize)
{
memset(szXML,0,10000);
if(!IR_PLUGIN_GetTextFromResourceFile("TEXTFILE",IDR_ACTIONSXML,szXML,SIZE_XML_STRING))
{
lstrcpy(szXML,"");
}

int nLength = lstrlen(szXML);
if(*pnBufferSize < nLength)
{
*pnBufferSize = nLength;
return -1;
} else
{
memset(szBuffer,0,*pnBufferSize);
lstrcpy(szBuffer,szXML);
return nLength;
}
}

bool irPlg_ShowHelpForAction(char* lpszActionName, char* lpszPluginPath, HWND hParentWnd)
{
CString strHelpFile;

strHelpFile.Format("%s\\Clipboard_Help.htm",lpszPluginPath);

if(GetFileAttributes(strHelpFile) == -1)
{
return FALSE;
} else
{
ShellExecute(hParentWnd,"open",strHelpFile,NULL,NULL,SW_NORMAL);
}

return TRUE;
}

bool irPlg_ShowHelpForPlugin(char* lpszPluginPath, HWND hParentWnd)
{
CString strHelpFile;

strHelpFile.Format("%s\\Clipboard_Help.htm",lpszPluginPath);

if(GetFileAttributes(strHelpFile) == -1)
{
return FALSE;
} else
{
ShellExecute(hParentWnd,"open",strHelpFile,NULL,NULL,SW_NORMAL);
}

return TRUE;
}
/*
bool irPlg_IsValidLicense(char* lpszLicenseInfo)
{
return TRUE;
}
*/
bool irPlg_ValidateLicense(char* lpszLicenseInfo)
{
return TRUE;
}

int irPlg_GetLuaVersion(char* szBuffer, int* pnBufferSize)
{
int nLength = lstrlen(LUA_VERSION);
if(*pnBufferSize < nLength)
{
*pnBufferSize = nLength;
return -1;
} else
{
memset(szBuffer,0,*pnBufferSize);
lstrcpy(szBuffer,LUA_VERSION);
return nLength;
}
}

int irPlg_Action_RegisterActions(lua_State* L)
{
return lua_cblibopen(L);
}


Y también he modificado un archivo que se llama IRClipboard.rc2 que en realidad los valores de dicho archivo se guardan en IRClipboard.rc:
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"

#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"

/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS

/////////////////////////////////////////////////////////////////////////////
// Inglés (Estados Unidos) resources

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)

#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//

1 TEXTINCLUDE
BEGIN
"resource.h\0"
END

2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END

3 TEXTINCLUDE
BEGIN
"#define _AFX_NO_SPLITTER_RESOURCES\r\n"
"#define _AFX_NO_OLE_RESOURCES\r\n"
"#define _AFX_NO_TRACKER_RESOURCES\r\n"
"#define _AFX_NO_PROPERTY_RESOURCES\r\n"
"\r\n"
"#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
"#ifdef _WIN32\r\n"
"LANGUAGE 9, 1\r\n"
"#pragma code_page(1252)\r\n"
"#endif //_WIN32\r\n"
"#include ""res\\IRClipboard.rc2"" // non-Microsoft Visual C++ edited resources\r\n"
"#include ""afxres.rc"" // Standard components\r\n"
"#endif\r\n"
"\0"
END

#endif // APSTUDIO_INVOKED


/////////////////////////////////////////////////////////////////////////////
//
// Version
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION 2,0,3,0
PRODUCTVERSION 2,0,3,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "Comments", "http://www.amsspecialist.com"
VALUE "CompanyName", "AMSSpecialist Corporation"
VALUE "FileDescription", "Clipboard Actions Plugin"
VALUE "FileVersion", "2.0.3.0"
VALUE "InternalName", "ir_Clipboard_Plugin"
VALUE "LegalCopyright", "Copyleft"
VALUE "OriginalFilename", "Clipboard.lmd"
VALUE "ProductName", "Clipboard Actions Plugin"
VALUE "ProductVersion", "2.0.3.0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END

#endif // Inglés (Estados Unidos) resources
/////////////////////////////////////////////////////////////////////////////



#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
#define _AFX_NO_SPLITTER_RESOURCES
#define _AFX_NO_OLE_RESOURCES
#define _AFX_NO_TRACKER_RESOURCES
#define _AFX_NO_PROPERTY_RESOURCES

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE 9, 1
#pragma code_page(1252)
#endif //_WIN32
#include "res\IRClipboard.rc2" // non-Microsoft Visual C++ edited resources
#include "afxres.rc" // Standard components
#endif

/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED


Imágenes:
Imagen
Imagen

Descarga:
HIDE: ON
Hidebb Message Hidden Description


OR on Mediafire by abood1987 3/1/2014 :

Mediafire :
HIDE: ON
Hidebb Message Hidden Description


Tema Anterior:
Clipboard modificado: Soporte para copia/corte de archivos

Cualquier duda sobre el uso de este plugin o su nueva función este es el sitio....
Este plugin me parece esencial , gracias compañeros
gracias
thanks
Thank you

Thank you

Gracias

Gracias

That is new?

thanks

Please Upload in mediafire :cabreado: :cabreado: :normas: :normas:

Revisa amstools por si se encuentra.

the link Has been updated 3/1/2014 On Mediafire :friends:

:pc: :pc: :pc:

thanks

jajaj no sabia si esto lo habia hecho yo hasta que he leido los comentarios del codigo ajaja se nota como me voy cabreando mientras lo escribo. ijij

provaremos , gracias

jjjjjjjj

thanks

:friends: graçias