Ejemplo n.º 1
0
int InitServer()
{
	int res = (CreateSystemEvents() || CreateSharedMem());

	return res;
}
Ejemplo n.º 2
0
bool make_exclusion_list(void)
{
	struct elist
	{
		struct elist *next;
		int flen;
		int option;
		char buff[1];
	} *p0 = NULL, **pp = &p0, *p;

	int t_len   = 0;
	int t_count = 0;
	char exclusionspath[MAX_PATH];

	// first read all strings into a list and calculate the size...
	FILE *fp = FileOpen(set_my_path(exclusionspath, "exclusions.rc"));
	if (fp) for (;;)
		{
			char *line, line_buffer[256];
			if (false == ReadNextCommand(fp, line_buffer, sizeof line_buffer))
			{
				FileClose(fp);
				break;
			}
			strlwr(line = line_buffer);
			int option = 0;
			if (0 == memicmp (line, "hook-early:", 11))
			{
				option = 1;
				line += 10;
				while (' ' == *++line);
			}

			int line_len = strlen(line);

			char *cp = strchr(line, ':');
			if (cp) *cp++ = 0;
			else *(cp = line + line_len++) = 0;
			p = (struct elist *)malloc(line_len + sizeof(struct elist));
			memcpy(p->buff, line, ++line_len);
			p->flen = cp - line;
			p->option = option;
			*(pp = &(*pp = p)->next) = NULL;
			t_len += line_len-2;
			t_count++;
		}

	t_len += sizeof(struct exclusion_info) + (t_count-1) * sizeof(struct exclusion_item);

	// ... then create the shared mem, which is supposed to succeed,...
	if (FALSE == CreateSharedMem(offset_exInfo + t_len))
		return false;

	// ... and finally copy the list into it, free items by the way.
	struct exclusion_info *pExclInfo = &lpvMem->exInfo;
	pExclInfo->size = t_len;
	pExclInfo->count = t_count;
	struct exclusion_item *ei = pExclInfo->ei;
	while (p0)
	{
		p = p0;
		p0 = p0->next;
		char *cp = ei->buff;
		ei->flen = 1+strlen(strcpy(cp, p->buff));
		ei->clen = 1+strlen(strcpy(cp+ei->flen, p->buff+p->flen));
		ei->option = p->option;
		//dbg_printf("added \"%s:%s\"", p->buff, p->p_class);
		free(p);
		ei = (struct exclusion_item *)(ei->buff + ei->flen + ei->clen);
	}
	return true;
}
Ejemplo n.º 3
0
int InitClient()
{
	int res = (CreateSystemEvents() || CreateMutexes() || CreateSharedMem());

	return res;
}