예제 #1
0
파일: nsDialogs.c 프로젝트: kichik/nsis-1
void __declspec(dllexport) SetUserData(HWND hwndParent, int string_size, char *variables, stack_t **stacktop, extra_parameters *extra)
{
  HWND hwCtl;
  struct nsControl* ctl;

  // get info from stack

  hwCtl = (HWND) popint();

  if (!IsWindow(hwCtl))
  {
    popint(); // remove user data from stack
    return;
  }

  // get descriptor

  ctl = GetControl(hwCtl);

  if (ctl == NULL)
    return;

  // set user data

  popstring(ctl->userData, USERDATA_SIZE);
}
예제 #2
0
파일: nsDialogs.c 프로젝트: kichik/nsis-1
void NSDFUNC SetControlCallback(size_t callbackIdx)
{
  HWND hwCtl;
  nsFunction  callback;
  nsFunction* callbacks;
  struct nsControl* ctl;

  // get info from stack

  hwCtl = (HWND) popint();
  callback = (nsFunction) popint();

  if (!IsWindow(hwCtl))
    return;

  // get descriptor

  ctl = GetControl(hwCtl);

  if (ctl == NULL)
    return;

  // set callback

  callbacks = (nsFunction*) &ctl->callbacks;
  callbacks[callbackIdx] = callback;
}
예제 #3
0
void __declspec(dllexport) SetTransparent(HWND hwndParent, int string_size, char *variables, stack_t **stacktop, extra_parameters *extra)
{  
WINUSERAPI
BOOL WINAPI SetLayeredWindowAttributes(HWND hwnd, COLORREF crKey, BYTE bAlpha, DWORD dwFlags);
	HWND hwnd;
	BYTE bAlpha;
	LONG lwnd;

  EXDLL_INIT();

//  MessageBox(hwndParent,"EXDLL_INIT",NULL,MB_OK);
  extra->RegisterPluginCallback(g_hInstance, PluginCallback);

	hwnd = (HWND) (popint());
	bAlpha = popint() * 255 / 100;
	if (IsWindow(hwnd))
	{
		lwnd = GetWindowLong(hwnd, GWL_EXSTYLE);
/*	  if (lwnd < WS_EX_LAYERED)
	  {
			lwnd = lwnd + WS_EX_LAYERED;
			SetWindowLong(hwnd, GWL_EXSTYLE, lwnd);
	  }*/
		SetWindowLong(hwnd, GWL_EXSTYLE, lwnd | WS_EX_LAYERED);
		SetLayeredWindowAttributes(hwnd, 0, bAlpha, LWA_ALPHA);
	}
}
예제 #4
0
void __declspec(dllexport) SetUserData(HWND hwndParent, int string_size, char *variables, stack_t **stacktop, extra_parameters *extra)
{
  HWND hwCtl;
//  struct nsControl* ctl;
//  struct s_control sCtl;
//  sCtl.controls = (struct control*) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct control));
      
  // get info from stack

  hwCtl = (HWND) popint();

  if (!IsWindow(hwCtl))
  {
    popint(); // remove user data from stack
    return;
  }

  // get descriptor

//  ctl = GetControl(hwCtl);
//  ctl = (struct nsControl*) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct nsControl));
  ctl = GetControl(hwCtl);

  if (ctl == NULL)
    return;

  // set user data

  popstringn(ctl->userData, USERDATA_SIZE);
//  ctl = NULL;
}
예제 #5
0
void NSDFUNC SetControlCallback(size_t callbackIdx)
{
  HWND hwCtl;
  nsFunction  callback;
  nsFunction* callbacks;
//  struct nsControl* ctl;
//  struct s_control sCtl;
//  sCtl.controls = (struct control*) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct control));

  // get info from stack

  hwCtl = (HWND) popint();
  callback = (nsFunction) popint();

  if (!IsWindow(hwCtl))
    return;
  //MessageBox(g_window.hwWindow,"(IsWindow(hwCtl)",NULL,MB_OK);

  // get descriptor

//  ctl = GetControl(hwCtl);
//  ctl = (struct nsControl*) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct nsControl));
  ctl = GetControl(hwCtl);

  if (ctl == NULL)
    return;

  // set callback

  callbacks = (nsFunction*) &ctl->callbacks;
  callbacks[callbackIdx] = callback;

//  ctl = NULL;
}
예제 #6
0
void __declspec(dllexport) GetUserData(HWND hwndParent, int string_size, char *variables, stack_t **stacktop, extra_parameters *extra)
{
  HWND hwCtl;
  struct nsControl* ctl;

  // get info from stack

  hwCtl = (HWND) popint();

  if (!IsWindow(hwCtl))
  {
    pushstring("");
    return;
  }

  // get descriptor

  ctl = GetControl(hwCtl);

  if (ctl == NULL)
  {
    pushstring("");
    return;
  }

  // return user data

  pushstring(ctl->userData);
}
예제 #7
0
void nsdKillTimer(HWND hwndParent, int string_size, char *variables, stack_t **stacktop, extra_parameters *extra)
{
  UINT id;

  // get timer id from stack

  id = popint();

  // kill timer

  KillTimer(g_dialog.hwDialog, id);
}
예제 #8
0
void __declspec(dllexport) CreateTimer(HWND hwndParent, int string_size, char *variables, stack_t **stacktop, extra_parameters *extra)
{
  UINT callback;
  UINT interval;

  // get info from stack

  callback = popint();
  interval = popint();

  if (!callback || !interval)
    return;

  // create timer

  SetTimer(
    g_dialog.hwDialog,
    callback,
    interval,
    TimerProc);
}
예제 #9
0
파일: classGraph.c 프로젝트: germuth/Kekule
int matchedR(int cover, Intstack gr) {
  int ed, size;
  if (cover == 0) return 1;
  if (gr->size == 0) return 0;
  ed = popint(gr);
  size = gr->size;
  if (matchedR(cover, gr)) return 1;
  gr->size = size;
  if ((ed | cover) != cover) return 0;
  cover = cover ^ ed;
  return matchedR(cover, gr);
}
예제 #10
0
op_makevec()
  {
  int n, depth;
  unsigned char *ptr, **array;
  depth = popint();
  array = malloc((depth+1)*sizeof(unsigned char *));   /* null terminated array */
  for (n=0; n < depth; n++) array[depth-n-1] = pop(0);
  array[depth] = (unsigned char *) 0;
  ptr = makevector(array, type_vector, subtype_general);
  for (n=0; n < depth; n++) free(array[n]);
  free(array);
  push(ptr);
  }
예제 #11
0
void __declspec(dllexport) onDropFiles(HWND hwndParent, int string_size, char *variables, stack_t **stacktop, extra_parameters *extra)
{  
  HWND hwCtl;
  //LONG lwnd;
  nsFunction  callback;

  // get info from stack

  hwCtl = (HWND) popint();
  callback = (nsFunction) popint();

  if (!IsWindow(hwCtl))
    return;

  //lwnd = GetWindowLong(hwCtl, GWL_EXSTYLE);
  //SetWindowLong(hwCtl, GWL_EXSTYLE, lwnd | WS_EX_ACCEPTFILES);
	DragAcceptFiles(hwCtl, TRUE);

  pushint((nsFunction) callback);
//  pushint((int) hwCtl);

	if (hwCtl == g_window.hwWindow)
		SetWindowCallback(WND_CALLBACK_IDX(onDropFiles));
	else
		{
			//size_t id;
			//id = g_window.controlCount - 1;
			//MessageBox(g_window.hwWindow,"control dropfiles",NULL,MB_OK);
			//g_window.controls[id].oldWndProc = (WNDPROC) SetWindowLong(hwCtl, GWL_WNDPROC, (long) DropFilesWndProc);
			ctl = GetControl(hwCtl);
			if (ctl == NULL)
				return;
			ctl->oldWndProc = (WNDPROC) SetWindowLong(hwCtl, GWL_WNDPROC, (long) DropFilesWndProc);

			pushint((int) hwCtl);

			SetControlCallback(CTL_CALLBACK_IDX(onDropFiles));
		}
}
예제 #12
0
void NSDFUNC SetDialogCallback(size_t callbackIdx)
{
  nsFunction  callback;
  nsFunction* callbacks;

  // get info from stack

  callback = (nsFunction) popint();

  // set callback

  callbacks = (nsFunction*) &g_dialog.callbacks;
  callbacks[callbackIdx] = callback;
}
예제 #13
0
op_makeveclu()
  {
  int n, depth,
      upper,
      lower;
  unsigned char *ptr, **array;

  upper = popint();
  lower = popint();
  depth = upper - lower + 1;
  array = malloc((depth+1)*sizeof(unsigned char *));   /* null terminated array */
  for (n=0; n < depth; n++)
	array[depth-n-1] = pop(0);

  array[depth] = (unsigned char *) 0;
  ptr = makevector(array, type_vector, subtype_general);
  /* set uppper and lower bounds */

  for (n=0; n < depth; n++)
	free(array[n]);

  free(array);
  push(ptr);
  }
예제 #14
0
void __declspec(dllexport) Create(HWND hwndParent, int string_size, char *variables, stack_t **stacktop, extra_parameters *extra)
{
  HWND hwPlacementRect;
  RECT rcPlacement;

  EXDLL_INIT();

  extra->RegisterPluginCallback(g_hInstance, PluginCallback);

  g_dialog.hwParent = hwndParent;
  g_pluginParms = extra;

  hwPlacementRect = GetDlgItem(hwndParent, popint());
  GetWindowRect(hwPlacementRect, &rcPlacement);
  MapWindowPoints(NULL, hwndParent, (LPPOINT) &rcPlacement, 2);

  g_dialog.hwDialog = CreateDialog(g_hInstance, MAKEINTRESOURCE(1), hwndParent, DialogProc);

  if (g_dialog.hwDialog == NULL)
  {
    pushstring("error");
    return;
  }

  SetWindowPos(
    g_dialog.hwDialog,
    0,
    rcPlacement.left,
    rcPlacement.top,
    rcPlacement.right - rcPlacement.left,
    rcPlacement.bottom - rcPlacement.top,
    SWP_NOZORDER | SWP_NOACTIVATE
  );

  g_dialog.parentOriginalWndproc = (WNDPROC) SetWindowLong(hwndParent, DWL_DLGPROC, (long) ParentProc);

  g_dialog.rtl = FALSE;

  g_dialog.controlCount = 0;
  g_dialog.controls = (struct nsControl*) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 0);

  g_dialog.callbacks.onBack = 0;

  pushint((int) g_dialog.hwDialog);
}
예제 #15
0
파일: nsDialogs.c 프로젝트: kichik/nsis-1
void __declspec(dllexport) CreateControl(HWND hwndParent, int string_size, char *variables, stack_t **stacktop, extra_parameters *extra)
{
  char *className;
  char *text;

  HWND hwItem;
  int x, y, width, height;
  DWORD style, exStyle;
  size_t id;

  // get info from stack

  className = (char *) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, g_stringsize * 2);
  text = &className[g_stringsize];

  if (!className)
  {
    pushstring("error");
    return;
  }

  if (popstring(className, 0))
  {
    pushstring("error");
    HeapFree(GetProcessHeap(), 0, className);
    return;
  }

  style = (DWORD) popint();
  exStyle = (DWORD) popint();

  PopPlacement(&x, &y, &width, &height);

  if (popstring(text, 0))
  {
    pushstring("error");
    HeapFree(GetProcessHeap(), 0, className);
    return;
  }

  // create item descriptor

  id = g_dialog.controlCount;
  g_dialog.controlCount++;
  g_dialog.controls = (struct nsControl*) HeapReAlloc(
    GetProcessHeap(),
    HEAP_ZERO_MEMORY,
    g_dialog.controls,
    g_dialog.controlCount * sizeof(struct nsControl));

  if (!lstrcmpi(className, "BUTTON"))
    g_dialog.controls[id].type = NSCTL_BUTTON;
  else if (!lstrcmpi(className, "EDIT"))
    g_dialog.controls[id].type = NSCTL_EDIT;
  else if (!lstrcmpi(className, "COMBOBOX"))
    g_dialog.controls[id].type = NSCTL_COMBOBOX;
  else if (!lstrcmpi(className, "LISTBOX"))
    g_dialog.controls[id].type = NSCTL_LISTBOX;
  else if (!lstrcmpi(className, "RichEdit"))
    g_dialog.controls[id].type = NSCTL_RICHEDIT;
  else if (!lstrcmpi(className, "RICHEDIT_CLASS"))
    g_dialog.controls[id].type = NSCTL_RICHEDIT2;
  else if (!lstrcmpi(className, "STATIC"))
    g_dialog.controls[id].type = NSCTL_STATIC;
  else if (!lstrcmpi(className, "LINK"))
    g_dialog.controls[id].type = NSCTL_LINK;
  else
    g_dialog.controls[id].type = NSCTL_UNKNOWN;

  // apply rtl to style

  ConvertStyleToRTL(g_dialog.controls[id].type, &style, &exStyle);

  // create item's window

  hwItem = CreateWindowEx(
    exStyle,
    lstrcmpi(className, "LINK") ? className : "BUTTON",
    text,
    style,
    x, y, width, height,
    g_dialog.hwDialog,
    (HMENU) (1200 + id),
    g_hInstance,
    NULL);

  g_dialog.controls[id].window = hwItem;

  // remember id

  SetProp(hwItem, NSCONTROL_ID_PROP, (HANDLE) (id + 1));

  // set font

  SendMessage(hwItem, WM_SETFONT, SendMessage(g_dialog.hwParent, WM_GETFONT, 0, 0), TRUE);

  // set the WndProc for the link control

  if(g_dialog.controls[id].type == NSCTL_LINK)
    g_dialog.controls[id].oldWndProc = (WNDPROC) SetWindowLong(hwItem, GWL_WNDPROC, (long) LinkWndProc);

  // push back result

  pushint((int) hwItem);

  // done

  HeapFree(GetProcessHeap(), 0, className);
}
예제 #16
0
파일: rtl.c 프로젝트: kichik/nsis-1
void __declspec(dllexport) SetRTL(HWND hwndParent, int string_size, char *variables, stack_t **stacktop, extra_parameters *extra)
{
  g_dialog.rtl = (BOOL) popint();
}
예제 #17
0
void __declspec(dllexport) Create(HWND hwndParent, int string_size, char *variables, stack_t **stacktop, extra_parameters *extra)
{
//  MSG Msg;
  WNDCLASS WndClass;
  HWND dhwPlacementRect;
  //HWND whwPlacementRect;
  HWND hwParent; //add by zhfi
//  HWND hwWindow; //add by zhfi
	//对话框尺寸
  RECT drcPlacement;
	//父窗口窗口位置
  RECT wrcPlacement;
	//WINDOWPLACEMENT *lpwndpl;
		
  int X, Y, nWidth, nHeight;

  DWORD dwExStyle, dwStyle;
  //LPCTSTR lpClassName, lpWindowName;
  char *lpClassName;
  char *lpWindowName;


//  s_plugins = (char *) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, g_stringsize * 2);
  lpClassName = (char *) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, g_stringsize * 2);
  lpWindowName = (char *) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, NSWINDOWS_MAX_STRLEN * 2);

  EXDLL_INIT();

//  MessageBox(hwndParent,"EXDLL_INIT",NULL,MB_OK);
  extra->RegisterPluginCallback(g_hInstance, PluginCallback);

//  MessageBox(hwndParent,"RegisterPluginCallback",NULL,MB_OK);
	//add by zhfi
	hwParent = (HWND) (popint());
//  MessageBox(hwndParent,"hwParent = (HWND) (popint())",NULL,MB_OK);
	if (IsWindow(hwParent))
    g_window.hwParent = hwParent;
  else
    g_window.hwParent = hwndParent;

	//获取窗口位置
	if (GetWindowRect(g_window.hwParent, &wrcPlacement))
		{
			X = wrcPlacement.left;
			Y = wrcPlacement.top;
			nWidth = wrcPlacement.right - wrcPlacement.left;
			nHeight = wrcPlacement.bottom - wrcPlacement.top;
		}
	else
		{
			X = 300;
			Y = 200;
			nWidth = 300;
			nHeight = 200;
		}
		
  g_pluginParms = NULL;
//  MessageBox(hwndParent,"g_pluginParms",NULL,MB_OK);

//  popstringn(lpWindowName, 0);
  dwExStyle = (DWORD) popint_or();
//  MessageBox(hwndParent,lpWindowName,NULL,MB_OK);
//  popstringn(lpWindowName, 0);
  dwStyle = (DWORD) popint_or();
//  MessageBox(hwndParent,lpWindowName,NULL,MB_OK);
  lpClassName = "#32770";
  popstringn(lpWindowName, NSWINDOWS_MAX_STRLEN);
//  MessageBox(hwndParent,lpWindowName,NULL,MB_OK);
  {
//    MEMSET (&WndClass,0,sizeof(WNDCLASS));
//    HeapAlloc(&WndClass, GMEM_MOVEABLE, sizeof(WNDCLASS));
    WndClass.style						= dwStyle;
    WndClass.lpfnWndProc			= WindowProc;
    WndClass.cbClsExtra       = 0;
    WndClass.cbWndExtra       = 0;
    WndClass.hInstance        = g_hInstance;
    WndClass.hIcon            = LoadIcon(NULL, "END");
    WndClass.hCursor					= LoadCursor(NULL, IDC_ARROW);
    WndClass.hbrBackground    = (HBRUSH)(GetStockObject(WHITE_BRUSH));
    WndClass.lpszMenuName			= NULL;
    WndClass.lpszClassName    = lpClassName;
//  MessageBox(hwndParent,"WndClass.lpszClassName",NULL,MB_OK);
    RegisterClass(&WndClass);
  }
//  MessageBox(hwndParent,"RegisterClass",NULL,MB_OK);
  
  g_window.hwWindow=CreateWindowEx(dwExStyle,
                                  WndClass.lpszClassName,
                                  lpWindowName,
                                  dwStyle,
                                  X,
                                  Y,
                                  nWidth,
                                  nHeight,
                                  hwParent,
                                  NULL,
                                  g_hInstance,
                                  NULL);

  if (g_window.hwWindow == NULL)
  {
    pushstring("error");
    return;
  }

//  MessageBox(hwndParent,"CreateWindowEx",NULL,MB_OK);
  
  g_pluginParms = extra;

  dhwPlacementRect = GetDlgItem(hwndParent, popint());
	if (IsWindow(dhwPlacementRect))
  if (GetWindowRect(dhwPlacementRect, &drcPlacement))
	{
		MapWindowPoints(NULL, hwndParent, (LPPOINT) &drcPlacement, 2);

		nWidth = drcPlacement.right - drcPlacement.left;
		nHeight = drcPlacement.bottom - drcPlacement.top;
	}

	X = X + (wrcPlacement.right - wrcPlacement.left - nWidth) / 2;
	Y = Y + (wrcPlacement.bottom - wrcPlacement.top - nHeight) / 2;

  SetWindowPos(
    g_window.hwWindow,
    0,
    X,
    Y,
    nWidth,
    nHeight,
    SWP_NOZORDER | SWP_NOACTIVATE| SWP_HIDEWINDOW
  );

  g_window.rtl = FALSE;

  g_window.controlCount = 0;
  g_window.controls = (struct nsControl*) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 0);

//  g_window.callbacks.onBack = 0;

  ShowWindow(g_window.hwWindow, SW_HIDE);

  pushint((int) g_window.hwWindow);
}