Driver: Fix comments.

This commit is contained in:
Nodir Temirkhodjaev 2018-02-17 08:50:37 +05:00
parent fe97a0830b
commit 3478c67964
4 changed files with 26 additions and 26 deletions

View File

@ -3,7 +3,7 @@
#define NDIS_WDM 1
#define NDIS630 1
#define WIN9X_COMPAT_SPINLOCK // XXX: Support Windows 7: KeInitializeSpinLock()
#define WIN9X_COMPAT_SPINLOCK /* XXX: Support Windows 7: KeInitializeSpinLock() */
#include <wdm.h>
#include <fwpmk.h>
@ -230,7 +230,7 @@ fort_callout_classify_v4 (const FWPS_INCOMING_VALUES0 *inFixedValues,
remote_ip = inFixedValues->incomingValue[remoteIpField].value.uint32;
if ((flags & FWP_CONDITION_FLAG_IS_LOOPBACK)
|| remote_ip == 0xFFFFFFFF) { // Local broadcast
|| remote_ip == 0xFFFFFFFF) { /* Local broadcast */
fort_callout_classify_permit(filter, classifyOut);
return;
}
@ -239,7 +239,7 @@ fort_callout_classify_v4 (const FWPS_INCOMING_VALUES0 *inFixedValues,
if (conf_ref == NULL) {
if (g_device->prov_boot || ((flags & FWP_CONDITION_FLAG_IS_REAUTHORIZE)
&& !g_device->was_conf)) { // Block existing flows after driver installation to use flow-contexts
&& !g_device->was_conf)) { /* Block existing flows after driver installation to use flow-contexts */
fort_callout_classify_block(classifyOut);
} else {
fort_callout_classify_continue(classifyOut);
@ -260,7 +260,7 @@ fort_callout_classify_v4 (const FWPS_INCOMING_VALUES0 *inFixedValues,
goto block;
process_id = (UINT32) inMetaValues->processId;
path_len = inMetaValues->processPath->size - sizeof(WCHAR); // chop terminating zero
path_len = inMetaValues->processPath->size - sizeof(WCHAR); /* chop terminating zero */
path = inMetaValues->processPath->data;
if (fort_conf_ip_inet_included(&conf_ref->conf, remote_ip)) {
@ -787,7 +787,7 @@ fort_callout_timer_force (void)
KLOCK_QUEUE_HANDLE lock_queue;
KeAcquireInStackQueuedSpinLock(&g_device->conf_lock, &lock_queue);
fort_callout_timer(); // Should be called from DISPATCH_LEVEL!
fort_callout_timer(); /* Should be called from DISPATCH_LEVEL! */
KeReleaseInStackQueuedSpinLock(&lock_queue);
}
@ -804,7 +804,7 @@ fort_device_create (PDEVICE_OBJECT device, PIRP irp)
KeAcquireInStackQueuedSpinLock(&g_device->conf_lock, &lock_queue);
if (g_device->is_opened) {
status = STATUS_SHARING_VIOLATION; // Only one client may connect
status = STATUS_SHARING_VIOLATION; /* Only one client may connect */
} else {
g_device->is_opened = TRUE;
}
@ -1028,8 +1028,8 @@ fort_driver_unload (PDRIVER_OBJECT driver)
static NTSTATUS
fort_bfe_wait (void) {
LARGE_INTEGER delay;
delay.QuadPart = -5000000; // sleep 500000us (500ms)
int count = 600; // wait for 5 minutes
delay.QuadPart = -5000000; /* sleep 500000us (500ms) */
int count = 600; /* wait for 5 minutes */
do {
const FWPM_SERVICE_STATE state = FwpmBfeStateGet0();

View File

@ -15,20 +15,20 @@
#define TCP_FLAG_CWR 0x0080
typedef struct tcp_header {
UINT16 source; // Source Port
UINT16 dest; // Destination Port
UINT16 source; /* Source Port */
UINT16 dest; /* Destination Port */
UINT32 seq; // Sequence number
UINT32 ack_seq; // Acknowledgement number
UINT32 seq; /* Sequence number */
UINT32 ack_seq; /* Acknowledgement number */
UCHAR res1 : 4; // Unused
UCHAR doff : 4; // Data offset
UCHAR res1 : 4; /* Unused */
UCHAR doff : 4; /* Data offset */
UCHAR flags; // Flags
UCHAR flags; /* Flags */
UINT16 window; // Window size
UINT16 csum; // Checksum
UINT16 urg_ptr; // Urgent Pointer
UINT16 window; /* Window size */
UINT16 csum; /* Checksum */
UINT16 urg_ptr; /* Urgent Pointer */
} TCP_HEADER, *PTCP_HEADER;
typedef struct fort_packet_in {
@ -143,7 +143,7 @@ fort_defer_add (PFORT_DEFER defer,
} else {
const tommy_count_t size = tommy_arrayof_size(&defer->packets);
// TODO: tommy_arrayof_grow(): check calloc()'s result for NULL
/* TODO: tommy_arrayof_grow(): check calloc()'s result for NULL */
if (tommy_arrayof_grow(&defer->packets, size + 1), 0) {
status = STATUS_INSUFFICIENT_RESOURCES;
goto end;

View File

@ -324,7 +324,7 @@ fort_stat_flow_add (PFORT_STAT stat, UINT64 flow_id,
} else {
const tommy_count_t size = tommy_arrayof_size(&stat->flows);
// TODO: tommy_arrayof_grow(): check calloc()'s result for NULL
/* TODO: tommy_arrayof_grow(): check calloc()'s result for NULL */
if (tommy_arrayof_grow(&stat->flows, size + 1), 0)
return STATUS_INSUFFICIENT_RESOURCES;
@ -491,7 +491,7 @@ fort_stat_flow_delete (PFORT_STAT stat, UINT64 flowContext)
PFORT_STAT_FLOW flow = (PFORT_STAT_FLOW) flowContext;
if (stat->closed)
return; // double check to avoid deadlock after remove-flow-context
return; /* double check to avoid deadlock after remove-flow-context */
KeAcquireInStackQueuedSpinLock(&stat->lock, &lock_queue);
if (!stat->closed) {
@ -515,7 +515,7 @@ fort_stat_flow_classify (PFORT_STAT stat, UINT64 flowContext,
UINT32 *proc_bytes = inbound ? &proc->traf.in_bytes
: &proc->traf.out_bytes;
// Add traffic to process
/* Add traffic to process */
*proc_bytes += data_len;
if (flow->opt.speed_limit) {
@ -531,7 +531,7 @@ fort_stat_flow_classify (PFORT_STAT stat, UINT64 flowContext,
UCHAR defer_flow = TRUE;
if (*group_bytes < limit_bytes) {
// Add traffic to app. group
/* Add traffic to app. group */
*group_bytes += data_len;
defer_flow = (*group_bytes >= limit_bytes);
@ -539,7 +539,7 @@ fort_stat_flow_classify (PFORT_STAT stat, UINT64 flowContext,
limited = TRUE;
}
// Defer ACK
/* Defer ACK */
if (inbound) {
flow->opt.defer_out = defer_flow;
} else {

View File

@ -54,9 +54,9 @@ fort_timer_update (PFORT_TIMER timer, BOOL run)
timer->running = run;
if (run) {
const LONG period = 500; // 500ms
const LONG period = 500; /* 500ms */
LARGE_INTEGER due;
due.QuadPart = period * -10000; // 500000us
due.QuadPart = period * -10000; /* 500000us */
KeSetTimerEx(&timer->id, due, period, &timer->dpc);
} else {